Skip to content

Instantly share code, notes, and snippets.

@sachintha81
Created July 26, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sachintha81/8878661b9bf872472e6be18da690859d to your computer and use it in GitHub Desktop.
Save sachintha81/8878661b9bf872472e6be18da690859d to your computer and use it in GitHub Desktop.
static string InsertThousandsSeparator(string input)
{
var dec = decimal.Parse(input);
var bits = decimal.GetBits(dec);
var prec = bits[3] >> 16 & 255;
return dec.ToString("N" + prec);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment