Currency Format in C# to shorten the output string
Posted
by james.ingham
on Stack Overflow
See other posts from Stack Overflow
or by james.ingham
Published on 2010-04-22T11:38:46Z
Indexed on
2010/04/22
11:43 UTC
Read the original article
Hit count: 471
Hey, I currently have a Currency Format method:
private string FormatCurrency(double moneyIn)
{
CultureInfo ci = new CultureInfo("en-GB");
return moneyIn.ToString("c", ci);
}
I'm looking to adapt this to shorten the string as the currency get's larger. Kind of like how stack overflow goes from 999 to 1k instead of 1000 (or 1.6k instead of 1555).
I imagine that this is a relativly easy task however is there any built in function for it or would you just have to manually manipulate the string?
Thanks
© Stack Overflow or respective owner