in reply to Re: Re: Regexp for alphbetical order match within the string
in thread Regexp for alphabetical order match within the string
Just for grins, this tests about 50% quicker than the substr version in your benchmark.
sub is_sorted{ my( $str, $p, $x ) = ( lc shift, 0 ); chop$x lt $x and return 0 while $x = substr $str, $p++, 2; 1; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regexp for alphbetical order match within the string
by Roy Johnson (Monsignor) on Oct 31, 2003 at 14:47 UTC |