Determines the style permitted in numerical string arguments that are passed to the Parse methods of the numeric base type classes.
[Visual Basic] Public Enum NumberStyles [C#] public enum NumberStyles [C++] public enum NumberStyles
[JScript] In JScript, you can use the enumerations in the NGWS frameworks, but you cannot define your own.
The symbols to be used for currency symbol, thousands separator, decimal point indicator, and leading sign are specified by NumberFormatInfo.
The attributes of NumberStyles are set by using the bitwise inclusive OR of the field flags. The Most Significant Bit (MSB) is the leftmost bit.
The third column lists the number styles with individual field flags, which are assigned as individual bits. The last five column headers (Any through Number) are composite number styles that combine individual field flags.
Under the composite number styles, a "1" means that the composite number style includes the individual number style in that row; a "0" means the composite number style does not include the individual number style in that row.
The hexadecimal representation of the composite number styles are listed in the last row of the table.
Bit | Hexadecimal | Number
styles with individual field flags |
Any | Currency | Float | Integer | Number |
---|---|---|---|---|---|---|---|
MSB: 1 | 100 | AllowCurrencySymbol | 1 | 1 | 0 | 0 | 0 |
MSB: 2 | 80 | AllowExponent | 1 | 0 | 1 | 0 | 0 |
MSB: 3 | 40 | AllowThousands | 1 | 1 | 0 | 0 | 1 |
MSB: 4 | 20 | AllowDecimalPoint | 1 | 1 | 1 | 0 | 1 |
MSB: 5 | 10 | AllowParentheses | 1 | 1 | 0 | 0 | 0 |
MSB: 6 | 8 | AllowTrailingSign | 1 | 1 | 0 | 0 | 0 |
MSB: 7 | 4 | AllowLeadingSign | 1 | 1 | 1 | 1 | 1 |
MSB: 8 | 2 | AllowTrailingWhite | 1 | 1 | 1 | 1 | 1 |
LSB: 9 | 1 | AllowLeadingWhite | 1 | 1 | 1 | 1 | 1 |
Hexadecimal -> | 1ff | 17f | 0a7 | 7 | 67 |
Member Name | Description |
---|---|
AllowCurrencySymbol | Indicates that a currency symbol is allowed. Valid currency symbols are determined by the CurrencySymbol property of NumberFormatInfo. |
AllowDecimalPoint | Indicates that a decimal point is allowed. Valid decimal point characters are determined by the NumberDecimalSeparator and CurrencyDecimalSeparator properties of NumberFormatInfo. |
AllowExponent | Indicates that an exponent is allowed. The format of the number should be {e|E} [{+|-}]xxx. |
AllowLeadingSign | Indicates that a leading sign is allowed. Valid leading sign characters are determined by the PositiveSign and NegativeSign properties of NumberFormatInfo. |
AllowLeadingWhite | Indicates that a leading white space is allowed. Valid white space characters have the Unicode encoding 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, and 0x0020. |
AllowParentheses | Indicates that parentheses are allowed. |
AllowThousands | Indicates that group separators are allowed; for instance, separating the hundreds from the thousands. Valid group separator characters are determined by the NumberGroupSeparator and CurrencyGroupSeparator properties of NumberFormatInfo, and the space between them is determined by the NumberGroupSize and CurrencyGroupSize properties of NumberFormatInfo. |
AllowTrailingSign | Indicates that a trailing sign is allowed. Valid trailing sign characters are determined by the PositiveSign and NegativeSign properties of NumberFormatInfo. |
AllowTrailingWhite | Indicates that trailing white space is allowed. Valid white space characters have the Unicode encoding 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, and 0x0020. |
Any | Indicates that all the AllowXXX bit styles are permitted. |
Currency | Indicates that all styles except AllowExponent are allowed |
Float | Indicates that the AllowLeadingWhite, AllowTrailingWhite, AllowLeadingSign, AllowDecimalPoint and AllowExponent styles are allowed. |
Integer | Indicates that the AllowLeadingWhite, AllowTrailingWhite, and AllowLeadingSign styles are allowed. |
None | Indicates that none of the bit styles are allowed. |
Number | Indicates that the AllowLeadingWhite, AllowTrailingWhite, AllowLeadingSign, AllowDecimalPoint and AllowThousands styles are allowed. |
Namespace: System.Globalization
Assembly: mscorlib.dll