Skip to content

Add str::starts_with_at() #7533

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

Closed
wants to merge 1 commit into from
Closed

Conversation

SimonSapin
Copy link
Contributor

Same as starts_with(), but takes an additional begin argument, an index in the string where to start looking. (Note: this is untested.)

Same as starts_with(), but takes an additional `begin` argument, an index in the string where to start looking.
@Aatch
Copy link
Contributor

Aatch commented Jul 1, 2013

For the sake of completeness, could you please add a test for it?

@huonw
Copy link
Member

huonw commented Jul 2, 2013

Is this necessary? What about x.slice_from(begin).starts_with(needle)?

@thestinger
Copy link
Contributor

I don't think we need functions like this since slicing is composable with the existing operations. There are many different types of indexing (byte, code point, grapheme) and you can index both the start and the end, so there's just too much variety to special case each function.

@thestinger thestinger closed this Jul 2, 2013
@SimonSapin
Copy link
Contributor Author

Ok, x.slice_from(begin).starts_with(needle) looks good enough.

flip1995 pushed a commit to flip1995/rust that referenced this pull request Aug 12, 2021
…r=xFrednet

fix bug on mutable ref

fixes: rust-lang#7524

This PR is related to issue rust-lang#7524
changelog:  [`extend_with_drain`] Improve code suggestion for mutable and immutable references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants