How to convert String format 1.203.45 to string format 1203.45. Tried to implement regular expressions, but nothing works. Java.
CodePudding user response:
You could use a regex replacement which removes all dots save the last one:
String input = "1.203.45";
String output = input.replaceAll("\\.(?=.*\\.)", "");
System.out.println(output); \\ 1203.45