How to replace characters from a String?

Asked

Viewed 1,498 times

4

I have a small problem. My application receives a numeric string representing a value from the server. But the server sends, for example "100.00" and I need to put a comma in place of that point.

100.00 => 100,00

I would like to know how to do this in the simplest way possible. I’ve looked around for tutorials that didn’t help me.

1 answer

4


A "simple" option is to use the method replace class String.

String valorComPonto = "100.00";
String valorComVirgula = valorComPonto.replace('.', ',');    
  • That’s right there. I didn’t find anything that would help me on the NET and I read the methods of the String class. Thank you, man! I should have paid more attention, but thank you anyway. = D I will accept the ASAP response

Browser other questions tagged

You are not signed in. Login or sign up in order to post.