Re: test if nth sign of a string is a number

2007-12-01 Thread [EMAIL PROTECTED]
On 1 Dez., 04:20, [EMAIL PROTECTED] (Jeff Pang) wrote: > On Nov 30, 2007 10:56 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hello, > > > how can I test if the nth (n=2) sign of a string is a number [0-9]? > > Thank you. > > Hello, > > Given you have this string: $str = "a9d0"; > > you can

Re: test if nth sign of a string is a number

2007-12-01 Thread Dr.Ruud
"Jeff Pang" schreef: > guba: >> how can I test if the nth (n=2) sign of a string is a number [0-9]? > > Given you have this string: $str = "a9d0"; > you can check if the 2nd character is a number or not by: > my $c = substr($str,1,1); > print ($c=~/[0-9]/) ? "a number" : "not a number";

Re: test if nth sign of a string is a number

2007-11-30 Thread Jeff Pang
On Nov 30, 2007 10:56 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > how can I test if the nth (n=2) sign of a string is a number [0-9]? > Thank you. > Hello, Given you have this string: $str = "a9d0"; you can check if the 2nd character is a number or not by: my $c = substr($str,

Re: test if nth sign of a string is a number

2007-11-30 Thread Tom Phoenix
On 11/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > how can I test if the nth (n=2) sign of a string is a number [0-9]? It sounds as if you want to examine a particular character indexed in a string; in Perl that's generally done with the substr() function. You can check whether it's a di

test if nth sign of a string is a number

2007-11-30 Thread [EMAIL PROTECTED]
Hello, how can I test if the nth (n=2) sign of a string is a number [0-9]? Thank you. Guenter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/