public member function
<locale>
std::numpunct::thousands_sep
char_type thousands_sep() const;
Return thousands separator character
Returns the character used to represent digit group separator.
For the standard specialization of
char the function returns
','.
For the standard specialization of
wchar_t the function returns
L','.
During its operation, the version of this function in the generic template simply calls the virtual protected member
do_thousands_sep, which is the member function in charge of performing the actions described above.
Parameters
none
Return value
The character used as digit group separator.
char_type is a member alias of the template parameter
charT (i.e., the facet's character type).
Example
1 2 3 4 5 6 7 8 9 10 11 12
|
// numpunct::thousands_sep example
#include <iostream>
#include <locale>
using namespace std;
int main ()
{
int q=10977;
char separator = use_facet<numpunct<char> >(cout.getloc()).thousands_sep ();
cout << q/1000 << separator << q%1000 << endl;
return 0;
}
|
Output:
See also
- numpunct::grouping
- Return grouping of digits (public member function)
- numpunct::decimal_point
- Return decimal point character (public member function)
- moneypunct::thousands_sep
- Return thousands separator character (public member function)