I have value in 133354.4
format but I want this as 133, 354.40
format only.
I don't know how to convert this using c#?
Thanks in advance.
I have value in 133354.4
format but I want this as 133, 354.40
format only.
I don't know how to convert this using c#?
Thanks in advance.
you need to use customized formatting (More) which is available in Globalization
using System.IO;
using System;
using System.Globalization;
class Program
{
static void Main()
{
double value = 133354.4;
Console.WriteLine(value.ToString("#,#.00", CultureInfo.InvariantCulture));
}
}
133,354.40
First, convert it to decimal
, for sample:
string number = "133354.4";
decimal value = decimal.Parse(number);
string formatedNumber = value.ToString("N");
ToString(string format)
method from decimal
type, has a format type you can specify the type of number you want to print. Look at the documentation and add the specific type you need.