I wonder if there is a way to use replace() with multiple replacement in one line in java. for example:
String precio_gold = "59,99$";
precio_gold = precio_gold.replace(",", ".");
precio_gold = precio_gold.replace("$", "");
And also if I there is a way to introduce more posibilites in the first "argument" of replace method, for example receive a price and depending if it has $ or € replace with "" (nothing):
precio_gold = precio_gold.replace("$" AND "€", ""); //This is wrong but I put just to see what I want to say.
replaceAllinstead ofreplace, which takes a regular expression as its first argument (instead of a literal string to replace):precio_gold.replaceAll("\\$|€", "");[$€]($has no special meaning in a character class so it does not need to be escaped)NumberFormat. See this SO question