I am getting this string from Db
str = "External - Internal ";
I want to remove the last whitespace from the string. I have already tried string.trim() and assigned it to another string Kindly suggest as this is just not working. below is my code for reference.
public static void main(String args[]){
String str = "External - Internal ";
String temp = str.trim();
System.out.println("1"+temp);
temp=str.replaceAll(" ", "");
System.out.println("2"+temp);
temp=str.replace("\\r", "");
System.out.println("3"+temp);
}
Regards Abhi