public static boolean belongsToAlphabet ( Alphabet < ? > alphabet , String string ) { for ( int i = 0 ; i < string . length ( ) ; ++ i ) if ( alphabet . symbolToCode ( string . charAt ( i ) ) == - 1 ) return false ; return true ; }
Check if a sequence contains letters only from specified alphabet . So in can be converted to corresponding type of sequence .