question: public static String trimTrailingCharacter ( String str , char trailingCharacter ) { if ( ! hasLength ( str ) ) { return str ; } StringBuilder sb = new StringBuilder ( str ) ; while ( sb . length ( ) > 0 && sb . charAt ( sb . length ( ) - 1 ) == trailingCharacter ) { sb . deleteCharAt ( sb . length ( ) - 1 ) ; } return sb . toString ( ) ; }
target:  Trim all occurrences of the supplied trailing character from the given String.