Possible Duplicate:
Inserting and removing commas from integers in c++
I want to write double values with the decimal separator as in the current locale, but I do not want it grouped by the grouping character from the current locale. The current approach with
stringstream s;
s.imbue(std::locale(""));
solves only one of the issues. The current output is like 1,234.567 instead of the wanted 1234.567
How can I change this?
with the help of dirkgently’s post inserting and removing commas from integers, I created the following class:
Important here is to derive from numpunkct_byname and initialize it with the constructor parameter “” for the local locale.
Then the stream can easily be imbued with the following code:
this will remove the grouping, but it will take the decimal separator from the local locale.