Skip to content

[7.x] Added new Stringable::leftTrim() and Stringable::rightTrim() methods#32288

Merged
taylorotwell merged 2 commits into
laravel:7.xfrom
ryangjchandler:feature/stringable-side-trim
Apr 8, 2020
Merged

[7.x] Added new Stringable::leftTrim() and Stringable::rightTrim() methods#32288
taylorotwell merged 2 commits into
laravel:7.xfrom
ryangjchandler:feature/stringable-side-trim

Conversation

@ryangjchandler
Copy link
Copy Markdown
Contributor

A trim() method already existed, but the neighbouring leftTrim() and rightTrim() methods were missing.

If they're not wanted in the framework, I can always macro them in but I think there would be quite a few use cases where you only want to trim from one end of the string, not both.

@taylorotwell
Copy link
Copy Markdown
Member

I would name them ltrim and rtrim to match the PHP functions. We already do something similar with ucfirst.

@ryangjchandler
Copy link
Copy Markdown
Contributor Author

@taylorotwell All done 🙂

@taylorotwell taylorotwell merged commit 4dd5501 into laravel:7.x Apr 8, 2020
@ryangjchandler ryangjchandler deleted the feature/stringable-side-trim branch April 8, 2020 19:39
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.

2 participants