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