blah blah blah is here! blah blah » Close

up1down
link

i am trying to convert the numbers like 11.11 to german culture as 11,11. pls find me code for this problem?

last answered one year ago

1 answers

up1down
link

Try:

using System;
using System.Globalization;

class Test
{
static void Main()
{
CultureInfo ci = CultureInfo.GetCultureInfo("de-DE"); // German
double d = 123.23;
string s = d.ToString(ci);
Console.WriteLine(s); // 123,23

CultureInfo ci2 = CultureInfo.GetCultureInfo("en-US"); // US English
double d2 = double.Parse(s, ci);
string s2 = d2.ToString(ci2);
Console.WriteLine(s2); // 123.23

Console.ReadKey();
}
}

Feedback