A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../locale/numpunct/grouping.html below:

std::numpunct<CharT>::grouping, std::numpunct<CharT>::do_grouping - cppreference.com

1) Public member function, calls the member function do_grouping of the most derived class.

This function returns a string, vec, which is used as a vector of integer values. (For example, "\003" specifies groups of 3 digits each, while "3" implies groups of 51 digits each.). Each element vec[i] represents the number of digits in the ith digit group of the integer part of the number, counting from the right: vec[0] holds the number of digits in the rightmost group, vec[1] - in the second group from the right, etc. The grouping indicated by the last character, vec[vec.size()-1], is repeatedly reused to group all remaining digits in the (left part of) the number. If vec[i] is non-positive or equals CHAR_MAX the size of the corresponding digit group is unlimited.

[edit] Return value

The object of type std::string holding the groups. The standard specializations of std::numpunct return an empty string, indicating no grouping. Typical groupings (e.g. the en_US locale) return "\003".

[edit] Example

Output:

Default locale: 12345678
Locale with modified numpunct: 1 2 3 4 5 6 7 8
Locale with \1\2\3 grouping: 18,446,744,073,709,551,61,5
Same, for a floating-point number: 123,456,78,9.123457
[edit] See also provides the character to use as thousands separator
(virtual protected member function) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4