How to replace the comma

0

I wanted to know how I can replace the comma to an end point.

Example: I have the following number 2.32 I wanted it to be 2.32.

How can I do this?

I already tried to use ToString(CultureInfo.InvariantCulture) but it still did not change.

    
asked by anonymous 06.11.2017 / 17:27

2 answers

6

You can do this:

double x = 2.32;
string texto = x.ToString("N", CultureInfo.CreateSpecificCulture("en-US"));

Reference: link

    
06.11.2017 / 17:37
0

You can use the method String.Replace(string1, string2) or String.Replace(char1, char2) , in 1 you put what you want to remove, and in 2 what you want to add, example:

string num = 2,32
num = num.Replace(',','.');
    
06.11.2017 / 17:42