public static boolean containsAnyOf ( String str , char ... chars ) { CharacterIterator iter = new StringCharacterIterator ( str ) ; for ( char c = iter . first ( ) ; c != CharacterIterator . DONE ; c = iter . next ( ) ) { for ( char match : chars ) { if ( c == match ) return true ; } } return false ; }
Return whether the supplied string contains any of the supplied characters .