How i can convert values in euro currency
For Example:- if There is 25000 then output will be €25.000
If There is 995 then €9,95
You can use built in .NET currency formatting, or you can customise it using code logic, here is the example of both
var dec = 25000;
string total = dec.ToString("C", new CultureInfo("en-GB")); // £25,000.00
Console.WriteLine(total);
var val = 995;
//custom check if number is three digit number
//add comma after first one.
if(val < 1000 && val > 99)
{
var val2 = "£" + val.ToString().Substring(0, 1) + "," + val.ToString().Substring(1, 2);
Console.WriteLine(val2); // output: £9,95
}
In the above code for "995", I have implemented my own logic to manipulate value.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly