
Hi I read the documentation and looked for some examples but I was not able to come up with a format string to do this: Format a double using desired grouping char and decimal separator. So 1234567.89 should print 1,234,567.89 First, how can I specify the usage of the grouping char ? sprintf uses the ' char but it gave me invalid format string every time I tried to use it. Also how can I specify the grouping char and decimal separator ? By setting the locale ? An example would be great. std::stringstream ss2; ss2 << boost::format ("%|.2f|") % src.get_valor_total (); String svalor_total = ss2.str (); Thank you in advance for your attention, Mau.

On Tue, Jun 8, 2010 at 07:18, Mauricio Gomes
Hi
I read the documentation and looked for some examples but I was not able to come up with a format string to do this:
Format a double using desired grouping char and decimal separator.
So 1234567.89 should print 1,234,567.89
First, how can I specify the usage of the grouping char ? sprintf uses the ' char but it gave me invalid format string every time I tried to use it. Also how can I specify the grouping char and decimal separator ? By setting the locale ?
An example would be great.
std::stringstream ss2; ss2 << boost::format ("%|.2f|") % src.get_valor_total (); String svalor_total = ss2.str ();
Thank you in advance for your attention, Mau. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Does std::numpunct_byname help ? Surya

Hi Surya,
Thanks for poiting std::numpunct out.
char_type thousands_sep() const; seems to be the one.
However, how do I instruct boost::format to use that ?
Thanks.
2010/6/9 Surya Kiran Gullapalli
On Tue, Jun 8, 2010 at 07:18, Mauricio Gomes
wrote: Hi
I read the documentation and looked for some examples but I was not able to come up with a format string to do this:
Format a double using desired grouping char and decimal separator.
So 1234567.89 should print 1,234,567.89
First, how can I specify the usage of the grouping char ? sprintf uses the ' char but it gave me invalid format string every time I tried to use it. Also how can I specify the grouping char and decimal separator ? By setting the locale ?
An example would be great.
std::stringstream ss2; ss2 << boost::format ("%|.2f|") % src.get_valor_total (); String svalor_total = ss2.str ();
Thank you in advance for your attention, Mau. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Does std::numpunct_byname help ? Surya _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Mauricio Gomes Pensar Digital 55-11-9698-1683 (Brazil - mobile)
participants (2)
-
Mauricio Gomes
-
Surya Kiran Gullapalli