Locale-sensitive number grouping

Raymond Chen

Raymond

Most westerners are familiar with the fact that the way numbers are formatted differ between the United States and much of Europe.

CultureFormat
United States1,234,567.89
France1 234 567,89
Germany1.234.567,89
Switzerland1’234’567.89

What people don’t realize is that the grouping is not always in threes. In India, the least significant group consists of three digits, but subsequent groups are in pairs.

India12,34,567.89

I’ve also seen reports that the first group consists of five digits, followed by pairs:

India12,34567.89

Meanwhile, Chinese and Japanese traditionally group in fours.

China, Japan123 4567.89

What does this mean for you? Don’t assume that numbers group in threes, and of course you can’t assume that the grouping separator is the comma and the decimal character is the period. Just use the GetNumberFormat function and let NLS do the work for you.

Next time, a little more about that NUMBERFMT structure.

Raymond Chen
Raymond Chen

Follow Raymond