Re: Help w/ sprintf
| From: | mailing_list at gmx dot at | Date: | Sat, 03 Mar 2001 13:59:41 +0000 |
| Subject: | Re: Help w/ sprintf | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42439@lists.php.net to get a copy of this message | ||
> What are the directives for the sprintf function to format an integer with
>
> commas (e.g.: 1,250,560)?
you don't mean commas but thousands' grouping???
if you want thousands' grouping it depends on your locale setting!
--cut--
For some numeric conversion a radic character (`decimal
point') or thousands' grouping character is used. The
actual character used depends on the LC_NUMERIC part of
the locale. The POSIX locale uses `.' as radix character,
and does not have a grouping character. Thus,
printf("%'.2f", 1234567.89);
results in `1234567.89' in the POSIX locale, in
1234567,89' in the nl_NL locale, and in 1.234.567,89' in
the da_DK locale.
--cut--
michael
--
Sent through GMX FreeMail - http://www.gmx.net