System.Globalization.NumberStyles define the presence and/or location of various elements in a string representation of a numeric value.
Where symbols such as a currency symbol are allowed in a System.Globalization.NumberStyles pattern, a System.Globalization.NumberFormatInfo instance defines the string representations of the symbols.
System.Globalization.NumberStyles values are passed to methods that convert between string and numeric data types, such as the Parse methods implemented by numeric base types. To specify multiple System.Globalization.NumberStyles values, use the bitwise OR operator.
For a list of the valid white space characters, see the string class.
| Member Name | Description |
|---|---|
| AllowCurrencySymbol | Specifies that a currency symbol is allowed. Note: See NumberFormatInfo.CurrencySymbol . |
| AllowDecimalPoint | Specifies that a decimal point is allowed. |
| AllowExponent |
Specifies that exponential notation is allowed. This style is used for values in one of the following forms: [-]m.ddddddE+xx [-]m.ddddddE-xx [-]m.dddddde+xx [-]m.dddddde-xx One or more non-zero digits (m) precede the decimal separator ("."). A minus sign ("-") can precede m. The type performing the conversion determines the number of decimal places (dddddd) in the string, and maximum and minimum values for xx and m. The exponent (+/-xx) consists of either a plus or minus sign followed by at least one digit. |
| AllowHexSpecifier |
Specifies that hexadecimal representation (Base 16) is allowed. Valid hexadecimal values include the numeric digits 0-9 and the hexadecimal digits A-F, and a-f. The hexadecimal digits can be in upper or lower case. Hexadecimal values can be left-padded with zeros. Strings parsed using this style are not permitted to be prefixed with "0x". |
| AllowLeadingSign | Specifies that a leading sign symbol is allowed. Note: See NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign . |
| AllowLeadingWhite | Specifies that the string can be prefixed with white space characters. |
| AllowParentheses | Specifies that one pair of balanced parentheses is allowed. |
| AllowThousands | Specifies that group separators are allowed; for instance, separating the hundreds from the thousands. |
| AllowTrailingSign | Specifies that a trailing sign symbol is allowed. Note: See NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign . |
| AllowTrailingWhite | Specifies that the string can be suffixed with white space characters. |
| Any | Specifies that NumberStyles.AllowLeadingWhite, NumberStyles.AllowTrailingWhite, NumberStyles.AllowLeadingSign, NumberStyles.AllowTrailingSign, NumberStyles.AllowParentheses, NumberStyles.AllowDecimalPoint, NumberStyles.AllowThousands, NumberStyles.AllowCurrencySymbol and NumberStyles.AllowExponent styles are allowed. |
| Currency | Specifies that NumberStyles.AllowLeadingWhite, NumberStyles.AllowTrailingWhite, NumberStyles.AllowLeadingSign, NumberStyles.AllowTrailingSign, NumberStyles.AllowParentheses, NumberStyles.AllowDecimalPoint, NumberStyles.AllowThousands, and NumberStyles.AllowCurrencySymbol styles are allowed. |
| Float | Specifies that NumberStyles.AllowLeadingWhite, NumberStyles.AllowTrailingWhite, NumberStyles.AllowLeadingSign, NumberStyles.AllowDecimalPoint and NumberStyles.AllowExponent styles are allowed. |
| HexNumber | Specifies that NumberStyles.AllowLeadingWhite, NumberStyles.AllowTrailingWhite, NumberStyles.AllowHexSpecifier styles are allowed. |
| Integer | Specifies that NumberStyles.AllowLeadingWhite, NumberStyles.AllowTrailingWhite, and NumberStyles.AllowLeadingSign styles are allowed. |
| None | Specifies that no styles are allowed. |
| Number | Specifies that NumberStyles.AllowLeadingWhite, NumberStyles.AllowTrailingWhite, NumberStyles.AllowLeadingSign, NumberStyles.AllowTrailingSign, NumberStyles.AllowDecimalPoint and NumberStyles.AllowThousands styles are allowed. |