moneypunct::thousands_sep


public member function
char_type thousands_sep() const;

Return thousands separator character

Returns the character used to represent digit group separator in monetary expressions.

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 in monetary expressions.
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
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// moneypunct example
#include <iostream>
#include <locale>
using namespace std;

// overload inserter to print patterns:
ostream& operator<< (ostream& os, moneypunct<char>::pattern p)
{
  for (int i=0; i<4; i++)
    switch (p.field[i]) {
      case moneypunct<char>::space: cout << "space "; break;
      case moneypunct<char>::symbol: cout << "symbol "; break;
      case moneypunct<char>::sign: cout << "sign "; break;
      case moneypunct<char>::value: cout << "value "; break;
    }
  return os;
}

int main ()
{
  locale mylocale;
  const moneypunct<char>& mp = use_facet<moneypunct<char> >(mylocale);

  cout << "moneypunct in locale \"" << mylocale.name() << "\":\n";

  cout << "decimal_point: " << mp.decimal_point() << endl;
  cout << "thousands_sep: " << mp.thousands_sep() << endl;
  cout << "grouping: " << mp.grouping() << endl;
  cout << "curr_symbol: " << mp.curr_symbol() << endl;
  cout << "positive_sign: " << mp.positive_sign() << endl;
  cout << "negative_sign: " << mp.negative_sign() << endl;
  cout << "frac_digits: " << mp.frac_digits() << endl;
  cout << "pos_format: " << mp.pos_format() << endl;
  cout << "neg_format: " << mp.neg_format() << endl;
  
  return 0;
} 


Possible output:

moneypunct in locale "C":
decimal_point:
thousands_sep:
grouping:
curr_symbol:
positive_sign:
negative_sign: -
frac_digits: 0
pos_format: symbol sign value
neg_format: symbol sign value


See also