public static String stripTrailingChar ( final String string , final 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 .