xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.

§ number_styles

enum xtd::number_styles
strong

Determines the styles permitted in numeric string arguments that are passed to the xtd::parse and xtd::try_parse methods of the integral and floating-point numeric types. This enumeration has a flags attribute that allows a bitwise combination of its member values.

Enumerator
none 

Indicates that no style elements, such as leading or trailing white space, thousands separators, or a decimal separator, can be present in the parsed string. The string to be parsed must consist of integral decimal digits only.

allow_leading_white 

Indicates that leading white-space characters can be present in the parsed string. Valid white-space characters have the Unicode values U+0009, U+000A, U+000B, U+000C, U+000D, and U+0020. Note that this is a subset of the characters for which the std::isspace(char) method returns true.

allow_trailing_white 

Indicates that trailing white-space characters can be present in the parsed string. Valid white-space characters have the Unicode values U+0009, U+000A, U+000B, U+000C, U+000D, and U+0020. Note that this is a subset of the characters for which the std::isspace(char) method returns true.

allow_leading_sign 

Indicates that the numeric string can have a leading sign.

allow_trailing_sign 

Indicates that the numeric string can have a trailing sign. Valid trailing sign characters are determined by the positive_sign and negative_sign properties.

allow_parentheses 

Indicates that the numeric string can have one pair of parentheses enclosing the number. The parentheses indicate that the string to be parsed represents a negative number.

allow_decimal_point 

Indicates that the numeric string can have a decimal point. If the number_styles value includes the allow_currency_symbol flag and the parsed string includes a currency symbol, the decimal separator character is determined by the std::use_facet<std::numpunct<char>>(std::locale()).decimal_point() method.

allow_thousands 

Indicates that the numeric string can have group separators, such as symbols that separate hundreds from thousands. If the number_styles value includes the allow_currency_symbol flag and the string to be parsed includes a currency symbol, the valid group separator character is determined by the currency_group_separator property, and the number of digits in each group is determined by the currency_Group_sizes property. Otherwise, the valid group separator character is determined by the number_group_separator property, and the number of digits in each group is determined by the number_group_sizes property.

allow_exponent 

Indicates that the numeric string can be in exponential notation. The allow_exponent flag allows the parsed string to contain an exponent that begins with the "E" or "e" character and that is followed by an optional positive or negative sign and an integer. In other words, it successfully parses strings in the form nnnExx, nnnE+xx, and nnnE-xx. It does not allow a decimal separator or sign in the significand or mantissa; to allow these elements in the string to be parsed, use the allow_decimal_point and allow_leading_sign flags, or use a composite style that includes these individual flags.

allow_currency_symbol 

Indicates that the numeric string can contain a currency symbol. Valid currency symbols are determined by the std::use_facet<std::moneypunct<char>>(std::locale()).curr_symbol() method.

allow_hex_specifier 

Indicates that the numeric string represents a hexadecimal value. Valid hexadecimal values include the numeric digits 0-9 and the hexadecimal digits A-F and a-f. Strings that are parsed using this style can be prefixed with "0x". A string that is parsed with the allow_hex_specifier style will always be interpreted as a hexadecimal value. The only flags that can be combined with allow_hex_specifier are allow_leading_white and allow_trailing_white. The number_styles enumeration includes a composite style, hex_number, that consists of these three flags.

allow_binary_specifier 

Indicates that the numeric string represents a binary value. Valid binary values include the numeric digits 0 and 1. Strings that are parsed using this style can be prefixed with "0b". A string that is parsed with the allow_binary_specifier style will always be interpreted as a binary value. The only flags that can be combined with allow_binary_specifier are allow_leading_white and allow_trailing_white. The number_styles enumeration includes a composite style, binary_number, that consists of these three flags.

allow_octal_specifier 

Indicates that the numeric string represents a octal value. Valid octal values include the numeric digits 0-7. Strings that are parsed using this style can be prefixed with "0". A string that is parsed with the allow_octal_specifier style will always be interpreted as an octal value. The only flags that can be combined with allow_octal_specifier are allow_leading_white and allow_trailing_white. The number_styles enumeration includes a composite style, octal_number, that consists of these three flags.

integer 

Indicates that the allow_leading_white, allow_trailing_white, and allow_leading_sign styles are used. This is a composite number style.

number 

Indicates that the allow_leading_white, allow_trailing_white, allow_leading_sign, allow_trailing_sign, allow_decimal_point, and allow_thousands styles are used. This is a composite number style.

fixed_point 

Indicates that the allow_leading_white, allow_trailing_white, allow_leading_sign, allow_decimal_point, and allow_exponent styles are used. This is a composite number style.

currency 

Indicates that all styles except allow_exponent, allow_hex_specifier, allow_binary_specifier and allow_octal_specifier are used. This is a composite number style.

any 

Indicates that all styles except allow_binary_specifier, allow_octal_specifier and allow_hex_specifier are used. This is a composite number style.

hex_number 

Indicates that the allow_leading_white, allow_trailing_white, and allow_hex_specifier styles are used. This is a composite number style.

binary_number 

Indicates that the allow_leading_white, allow_trailing_white, and allow_binary_specifier styles are used. This is a composite number style.

octal_number 

Indicates that the allow_leading_white, allow_trailing_white, and allow_octal_specifier styles are used. This is a composite number style.