NumberStyles.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Globalization
  5. {
  6. /// <summary>
  7. /// Contains valid formats for Numbers recognized by the Number
  8. /// class' parsing code.
  9. /// </summary>
  10. [Flags]
  11. public enum NumberStyles
  12. {
  13. None = 0x00000000,
  14. /// <summary>
  15. /// Bit flag indicating that leading whitespace is allowed. Character values
  16. /// 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, and 0x0020 are considered to be
  17. /// whitespace.
  18. /// </summary>
  19. AllowLeadingWhite = 0x00000001,
  20. /// <summary>
  21. /// Bitflag indicating trailing whitespace is allowed.
  22. /// </summary>
  23. AllowTrailingWhite = 0x00000002,
  24. /// <summary>
  25. /// Can the number start with a sign char specified by
  26. /// NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign
  27. /// </summary>
  28. AllowLeadingSign = 0x00000004,
  29. /// <summary>
  30. /// Allow the number to end with a sign char
  31. /// </summary>
  32. AllowTrailingSign = 0x00000008,
  33. /// <summary>
  34. /// Allow the number to be enclosed in parens
  35. /// </summary>
  36. AllowParentheses = 0x00000010,
  37. AllowDecimalPoint = 0x00000020,
  38. AllowThousands = 0x00000040,
  39. AllowExponent = 0x00000080,
  40. AllowCurrencySymbol = 0x00000100,
  41. AllowHexSpecifier = 0x00000200,
  42. Integer = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign,
  43. HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier,
  44. Number = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
  45. AllowDecimalPoint | AllowThousands,
  46. Float = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
  47. AllowDecimalPoint | AllowExponent,
  48. Currency = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
  49. AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol,
  50. Any = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
  51. AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol | AllowExponent,
  52. }
  53. }