IMG-LOGO

How to format currency in string using ASP.Net C#?

andy - 25 Jul, 2013 3023 Views 0 Comment

In this tutorial, you will learn how you can format a currency using string in ASP.Net C#.

There are two methods you can use to format the string into currency, please see the example format string function below:

//decimal currencyValue = 100;
string strCurrency = "";

//You can use ToString("n") 
strCurrency = currencyValue.ToString("n");

//Or alternatively you can use ToString("0.00") 
strCurrency = currencyValue.ToString("0.00");

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.

Related Articles

How to remove html tags from string in c#?

Sometimes you need to remove HTML tags from string to ensure there are no dangerous or malicious scripts especially when you want to store the string or data text into the database.