Hi,
How do I format numeric values as comma delimited strings?
These data are returned to me as XML. I transform it using XSLT, and present it as html. But I need to format these numeric values the way the client wants it.
e.g.
12345 => 12,345
1235.12345 => 1,234.12345
13.3566 => 13.3566
132341.00 => 132,341.00
I've been playing all day with FLOOR, money, string manipulation but I still can't find an answer to my problem.
Any help would be greatly appreciated.
Thank you very much.
Loading
Jan MontanoPosted Nov 12, 2009, 4:57 AM
Jan MontanoPosted Nov 12, 2009, 4:50 AM
The problem with money is the style. It's limited. it has specific decimal places. I don't want to modify the decimal places in any way. I want it to be converted as is. I just need the comma separation and not modify anything else.
Gaurish KumarPosted Nov 11, 2009, 3:39 AM
try this in the page
string val = "132341.12456";
if (val.Contains("."))
Label1.Text = String.Format("{0:0,0.00####}", double.Parse(val));
else
Label1.Text = String.Format("{0:0,0}", int.Parse(val));
Hope this will help you
naura paxPosted Nov 11, 2009, 3:17 AM
CONVERT(varchar, CONVERT(money, YourFieldName), 1)