Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
No such thing as a small change
 
PerlMonks  

Re: Challenge - Creative Way To Detect Alpha Characters

by CombatSquirrel (Hermit)
on Sep 13, 2004 at 14:07 UTC ( [id://390627]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Challenge - Creative Way To Detect Alpha Characters

The plain old C way:
#!perl use strict; use warnings; sub contains_alpha($) { my ($ord_a, $ord_z, $ord_A, $ord_Z) = map ord, qw/a z A Z/; for (split //, $_[0]) { $_ = ord $_; return 1 if ($ord_a <= $_ and $_ <= $ord_z) || ($ord_A <= $_ and $_ <= + $ord_Z); } return 0; } for (<DATA>) { chomp; print "'$_' " . (contains_alpha $_ ? 'contains' : 'does not contain +') . " standard alphabet characters\n"; } __DATA__ Hi 123456789o 1234567890 xAFCE3 xAFCEA ... --- ... .s. -o- .s.
Not really creative, though...
CombatSquirrel.

Entropy is the tendency of everything going to hell.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://390627]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.