Skip to content

[String] Add trimSuffix() and trimPrefix() methods #43481

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

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 5.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Inspired by golang's string API.

@carsonbot
Copy link

Hey!

I think @fancyweb has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@fabpot
Copy link
Member

fabpot commented Oct 15, 2021

Thank you @nicolas-grekas.

@javiereguiluz
Copy link
Member

But aren't these very similar (the same?) as the existing methods after() and beforeLast() ?

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Oct 15, 2021

They're not the same: the needle passed to after/before can be found anywhere in the string, not only at the start/end.

@javiereguiluz
Copy link
Member

Ah, that's indeed different. Thanks for the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants