Is there any inbuilt method for trimming only trailing white spaces from a string? that is similar to rtrim available in other languages
Example: String str1 = "stackoverflow "; String str2 = " stackoverflow ";
should become,
str1 = "stackoverflow"; str2 = " stackoverflow";