Convert string to dollor
How to convert string to dolor in C#. I need a piece of code
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
kuru moorthyPosted Aug 30, 2013, 2:58 AM
System.Globalization.CultureInfo info = new System.Globalization.CultureInfo("en-US");
String.Format(info, Convert.ToString("{0:$#,##0.00}"), Convert.ToDouble(5.35));
This gives result for 2 decimal places
VulpesPosted Aug 29, 2013, 6:38 AM
More generally, you can do this:
Pawan ChandPosted Aug 29, 2013, 6:25 AM
decimal decCurrency = Convert.ToDecimal(strCurrency);
string formatValue = String.Format("Dollar Value: {0:C}", decCurrency);
Console.WriteLine(formatValue);
Console.ReadLine();
Output-> Dollar Value: $100.50
Sanjeeb LenkaPosted Aug 29, 2013, 5:22 AM
i didn' get you. plz provide more details or example what actually you want.