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

Open
lizmat opened this issue Jan 13, 2020 · 0 comments
Open

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

lizmat opened this issue Jan 13, 2020 · 0 comments
Assignees
Labels

Comments

@lizmat
Copy link
Contributor

@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
Projects
None yet
2 participants
You can’t perform that action at this time.