public member function
<locale>

std::numpunct::thousands_sep

char_type thousands_sep() const;
Thousands separator character
Returns the character used to represent the digit group separator.

For the standard specialization numpunct<char>, the function returns ','.
For the standard specialization numpunct<wchar_t>, the function returns L','.

Internally, this function simply calls the virtual protected member do_thousands_sep, which for the standard specializations returns:
specializationreturns
numpunct<char>','
numpunct<wchar_t>L','


Parameters

none

Return value

The character used as the digit group separator.
Member type char_type is the facet's character type (defined as an alias of numpunct's template parameter, charT).

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
// numpunct::thousands_sep example
#include <iostream>       // std::cout
#include <locale>         // std::locale, std::numpunct, std::use_facet

int main ()
{
  int q=10077;
  char separator = std::use_facet< std::numpunct<char> >(std::cout.getloc()).thousands_sep();
  std::cout << q/1000 << separator;
  std::cout.width(3); std::cout.fill ('0');
  std::cout << q%1000 << '\n';
  return 0;
}


Output:

10,077

Data races

The facet is accessed.

Exception safety

Strong guarantee: No side effects in case an exception is thrown.

See also