1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Formatting numeric values with commas

Discussion in 'C' started by Luther von Wulf, Aug 28, 2010.

  1. Luther von Wulf

    Luther von Wulf New Member

    Aug 28, 2010
    Likes Received:
    Trophy Points:
    This function reformats a numeric sequence to include grouping in the usual human readable format. "123456789" becomes "123,456,789", for example. The formatting is localized to the current running machine. In a German locale the previous example becomes "123.456.789". In a Hindi locale it becomes "12,34,56,789". Printing numbers for human consumption is a common request. C does not offer direct support for it, nor are there many examples that are complete for use outside of the US that I could find.

Share This Page