Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Str.(r)index(@needles) #148

lizmat opened this issue Jan 13, 2020 · 0 comments

Add Str.(r)index(@needles) #148

lizmat opened this issue Jan 13, 2020 · 0 comments


Copy link

@lizmat lizmat commented Jan 13, 2020

Sometimes you want to find the first (or last in the case of rindex)
of a number of characters in a string. This is now easily possible:

"foobarbaz".index(<z a o>);   # 1
"foobarbaz".rindex(<o a z>);  # 8

Of course, if none of the needles are found, it returns Nil.

An implementation can be found at: rakudo/rakudo#3418

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.