I am having a string like this
String s1 = "2999.1049.00_GRB.1";
String s2 = "my File.txt.txt";
I want to replace the last ".1" with "_1" and ".txt" with "_txt"
The result of the String should be
s1 = "2999.1049.00_GRB_1" and s2 = "my File.txt_txt"
How can I do this. I am aware of replacing the first occurrence of the string. but don't know how to replace the last occurrence of a string.