NumberStyles.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. /*============================================================
  5. **
  6. **
  7. **
  8. ** Purpose: Contains valid formats for Numbers recognized by
  9. ** the Number class' parsing code.
  10. **
  11. **
  12. ===========================================================*/
  13. namespace System.Globalization
  14. {
  15. [Flags]
  16. public enum NumberStyles
  17. {
  18. // Bit flag indicating that leading whitespace is allowed. Character values
  19. // 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, and 0x0020 are considered to be
  20. // whitespace.
  21. None = 0x00000000,
  22. AllowLeadingWhite = 0x00000001,
  23. AllowTrailingWhite = 0x00000002, //Bitflag indicating trailing whitespace is allowed.
  24. AllowLeadingSign = 0x00000004, //Can the number start with a sign char.
  25. //Specified by NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign
  26. AllowTrailingSign = 0x00000008, //Allow the number to end with a sign char
  27. AllowParentheses = 0x00000010, //Allow the number to be enclosed in parens
  28. AllowDecimalPoint = 0x00000020, //Allow a decimal point
  29. AllowThousands = 0x00000040, //Allow thousands separators (more properly, allow group separators)
  30. AllowExponent = 0x00000080, //Allow an exponent
  31. AllowCurrencySymbol = 0x00000100, //Allow a currency symbol.
  32. AllowHexSpecifier = 0x00000200, //Allow specifiying hexadecimal.
  33. //Common uses. These represent some of the most common combinations of these flags.
  34. Integer = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign,
  35. HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier,
  36. Number = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
  37. AllowDecimalPoint | AllowThousands,
  38. Float = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
  39. AllowDecimalPoint | AllowExponent,
  40. Currency = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
  41. AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol,
  42. Any = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
  43. AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol | AllowExponent,
  44. }
  45. }