in reply to Challenge - Creative Way To Detect Alpha Characters

use Inline "C"; print is_alpha("foo"); __END__ __C__ int is_alpha( char * str ) { while ( *str != '\0' ) { if ( ((*str >= 97) && (*str <=122)) || ((*str >= 65) && (*str +<=90)) ) return 1; str++; } return 0; }

cheers

tachyon

Replies are listed 'Best First'.
Re^2: Challenge - Creative Way To Detect Alpha Characters
by Pragma (Scribe) on Sep 14, 2004 at 04:18 UTC
    Or:
    use Inline "C"; print is_alpha("foo"); __END__ __C__ int is_alpha( char * str ) { while ( *str ) if ( isalpha( *str++ ) ) return 1; return 0; }