Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Challenge - Creative Way To Detect Alpha Characters

by tachyon (Chancellor)
on Sep 14, 2004 at 02:11 UTC ( [id://390723]=note: print w/replies, xml ) Need Help??


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; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://390723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-03-29 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found