public static boolean isAlphabetic ( String s ) { if ( isEmpty ( s ) ) return defaultEmptyOK ; // Search through string's characters one by one // until we find a non-alphabetic character. // When we do, return false; if we don't, return true. for ( int i = 0 ; i < s . length ( ) ; i ++ ) { // Check that current character is letter. char c = s . charAt ( i ) ; if ( ! isLetter ( c ) ) return false ; } // All characters are letters. return true ; }
Returns true if string s is letters only .