New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Format an integer as a string with a culture specific thousand separator

66 Views
Copy Code Show/Hide Line Numbers
   1:  int intValue = 1512;
   2:  string stringValue = intValue.ToString("#,#", CultureInfo.GetCultureInfo(Thread.CurrentThread.CurrentCulture.Name));
   3:  /* Result in US English (en-US) will be 1,512
   4:     Result in Swedish (sv-SE) will be 1 512 */
by rawbert
  April 29, 2010 @ 4:53am
Tags:
Comment:
Use C# to present numeric values as a string with a proper culture specific thousand separator, often used when presenting financial or market data.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies


If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate