{"id":31513,"date":"2006-04-17T10:00:06","date_gmt":"2006-04-17T10:00:06","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/04\/17\/locale-sensitive-number-grouping\/"},"modified":"2006-04-17T10:00:06","modified_gmt":"2006-04-17T10:00:06","slug":"locale-sensitive-number-grouping","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060417-06\/?p=31513","title":{"rendered":"Locale-sensitive number grouping"},"content":{"rendered":"<p>Most westerners are familiar with the fact that the way numbers are formatted differ between the United States and much of Europe.<\/p>\n<table>\n<tr>\n<th style=\"width: 10em\">Culture<\/th>\n<th>Format<\/th>\n<\/tr>\n<tr>\n<td style=\"width: 10em\">United States<\/td>\n<td>1,234,567.89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 10em\">France<\/td>\n<td>1 234 567,89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 10em\">Germany<\/td>\n<td>1.234.567,89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 10em\">Switzerland<\/td>\n<td>1&#8217;234&#8217;567.89<\/td>\n<\/tr>\n<\/table>\n<p> What people don&#8217;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.<\/p>\n<table>\n<tr>\n<td style=\"width: 10em\">India<\/td>\n<td>12,34,567.89<\/td>\n<\/tr>\n<\/table>\n<p> I&#8217;ve also seen reports that the first group consists of five digits, followed by pairs:<\/p>\n<table>\n<tr>\n<td style=\"width: 10em\">India<\/td>\n<td>12,34567.89<\/td>\n<\/tr>\n<\/table>\n<p> Meanwhile, Chinese and Japanese traditionally group in fours.<\/p>\n<table>\n<tr>\n<td style=\"width: 10em\">China, Japan<\/td>\n<td>123 4567.89<\/td>\n<\/tr>\n<\/table>\n<p> What does this mean for you? Don&#8217;t assume that numbers group in threes, and of course you can&#8217;t assume that the grouping separator is the comma and the decimal character is the period. Just use the <code>GetNumberFormat<\/code> function and let NLS do the work for you.<\/p>\n<p> Next time, a little more about that <code>NUMBERFMT<\/code> structure. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most westerners are familiar with the fact that the way numbers are formatted differ between the United States and much of Europe. Culture Format United States 1,234,567.89 France 1 234 567,89 Germany 1.234.567,89 Switzerland 1&#8217;234&#8217;567.89 What people don&#8217;t realize is that the grouping is not always in threes. In India, the least significant group consists [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-31513","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Most westerners are familiar with the fact that the way numbers are formatted differ between the United States and much of Europe. Culture Format United States 1,234,567.89 France 1 234 567,89 Germany 1.234.567,89 Switzerland 1&#8217;234&#8217;567.89 What people don&#8217;t realize is that the grouping is not always in threes. In India, the least significant group consists [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=31513"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31513\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=31513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=31513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=31513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}