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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 29, 2013, 1:22 AM EDT
i didn' get you. plz provide more details or example what actually you want.
Pawan Chand157 reputationPosted Aug 29, 2013, 2:25 AM EDT
decimal decCurrency = Convert.ToDecimal(strCurrency);
string formatValue = String.Format("Dollar Value: {0:C}", decCurrency);
Console.WriteLine(formatValue);
Console.ReadLine();
Output-> Dollar Value: $100.50
VulpesRank #55 · 29.2K reputationPosted Aug 29, 2013, 2:38 AM EDT
More generally, you can do this:
kuru moorthy4 reputationPosted Aug 29, 2013, 10:58 PM EDT
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