System.Globaization

  • Thread starter Thread starter Manoj Shirahatti
  • Start date Start date
M

Manoj Shirahatti

Hello All,

I have String "7.5" . I want to convert it to string of the form "7,5".
Basically the decimal separator has to be changed on the CurrentCulture.
I am to do this when the value is double for eg double temp = 7.5 .
I use the following
convert = temp.ToString(CultureInfo.CurrentCulture);

I get the value as 7,5.



How do i get it when it is string.



Manoj
 
Manoj Shirahatti said:
I have String "7.5" . I want to convert it to string of the form "7,5".

Right - so you need to parse it with the invariant culture, and then
format it with the current culture. In other words:

double tmp = Double.Parse (myString, CultureInfo.InvariantCulture);
string converted = tmp.ToString (CultureInfo.CurrentCulture);
 
Back
Top