Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java replace a character at end of string

// Algorithm to replace a specific character from end of string.
// From: 10.000.000.00
// To: 10.000.000,00
String cash = "10.000.000.00";
StringBuilder temp1 = new StringBuilder(cash);
StringBuilder temp2 = new StringBuilder(temp1.reverse().toString().replaceFirst("[.]", ","));
System.out.println(temp2.reverse());
 
PREVIOUS NEXT
Tagged: #java #replace #character #string
ADD COMMENT
Topic
Name
1+4 =