public static String stripTrailingChar(String string,char c){
  if (string.length() > 0) {
    if (string.charAt(string.length() - 1) == c) {
      return string.substring(0,string.length() - 1);
    }
  }
  return string;
}

public static String stripTrailingChar ( String string , char c ) { if ( string . length ( ) > 0 ) { if ( string . charAt ( string . length ( ) - 1 ) == c ) { return string . substring ( 0 , string . length ( ) - 1 ) ; } } return string ; }
strips trailing char if string ends with one .
