-
Notifications
You must be signed in to change notification settings - Fork 654
feat(text/unstable): add trimBy
functions
#6778
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6778 +/- ##
==========================================
+ Coverage 94.14% 94.19% +0.05%
==========================================
Files 588 590 +2
Lines 42512 42577 +65
Branches 6701 6718 +17
==========================================
+ Hits 40022 40106 +84
+ Misses 2440 2421 -19
Partials 50 50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
How about naming these like |
Done. I also removed the option to use a scalar string as the argument, because IMO the behavior of treating it as chars is kinda confusing (even though that's what the equivalent PHP functions do). |
Sorry for the delay in review.
I agree with this, but how about treating |
trim
functionstrimBy
functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for updating! (I added some examples in docs)
Resolves #6265 (another attempt at abandoned #6286). Similar functionality to PHP
trim
/ltrim
/rtrim
.String#trim
family (notstrip
etc). Is this too confusing vsString#trim
? Really it's the same asString#trim
, just with an additional argument that can be configured (the pattern to trim).trim('aaxxbb', /[ab]/)
givesxx
, notaxxb
oraxxbb
)