Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: opposite of index+rindex? How-to? Needed?

by davido (Cardinal)
on Aug 30, 2019 at 02:57 UTC ( [id://11105284]=note: print w/replies, xml ) Need Help??


in reply to opposite of index+rindex? How-to? Needed?

String::Index provides ncindex and ncrindex, which I think provide what you're after.

my $pos = ncindex($string, 'c'); # find first non-c

The needle string ('c' in this case) can be more than one character, in which case it will find the position of the first character in $string that isn't found in the string of search characters.


Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-19 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found