public void rtrim(){
  int index=text.length();
  while ((index > 0) && (text.charAt(index - 1) <= ' ')) {
    index--;
  }
  text=text.substring(0,index);
}

public void rtrim ( ) { int index = text . length ( ) ; while ( ( index > 0 ) && ( text . charAt ( index - 1 ) <= ' ' ) ) { index -- ; } text = text . substring ( 0 , index ) ; }
trim all whitespace from the right of the template text
