question: public static String retainAllChars ( String str , String retainChars ) { int pos = indexOfChars ( str , retainChars ) ; if ( pos == - 1 ) { return "" ; } StringBuilder buf = new StringBuilder ( ) ; do { buf . append ( str . charAt ( pos ) ) ; pos = indexOfChars ( str , retainChars , pos + 1 ) ; } while ( pos != - 1 ) ; return buf . toString ( ) ; }
target:  Removes all characters from 'str' that are not in 'retainChars'. Example: retainAllChars("Hello, world!", "lo") returns "llool"