question: public static String trim ( String str , CharacterPredicate predicate ) { int len = str . length ( ) ; if ( len == 0 ) return str ; int st = 0 ; while ( ( st < len ) && predicate . test ( str . charAt ( st ) ) ) { st ++ ; } while ( ( st < len ) && predicate . test ( str . charAt ( len - 1 ) ) ) { len -- ; } return ( ( st > 0 ) || ( len < str . length ( ) ) ) ? str . substring ( st , len ) : str ; }
target:  Trim away any leading or trailing characters that satisfy the supplied predicate