in reply to character test functions
We have regular expressions, and they have metacharacters and character classes.
if ( $char =~ /\d/ ) { print "It's a digit.\n"; } if ( $char =~ /\w/ ) { print "It's a word-like character.\n"; } if ( $char =~ /[a-zA-Z]/ ) { print "It's an asciibetical alpha character.\n"; } if ( $char =~ /[[:alpha:]]/ ) { print "It's an alpha character.\n"; }
...just to name a few possibilities. See perlre for details.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: character test functions
by ambrus (Abbot) on Nov 03, 2005 at 08:10 UTC |