-
-
Notifications
You must be signed in to change notification settings - Fork 706
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 range support to std.string.stripLeft #3187
Conversation
64bb293 to
0652a01
Compare
|
std.algorithm.mutation already has generic |
|
Unfortunately, the generic strip does not decode ranges of char or wchar: |
|
|
||
| import std.utf : byChar; | ||
| import std.array; | ||
| assert(stripLeft(" hello world "w.byChar).array == |
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.
Instead of calling .array, you should be able to use .equal to verify equality and you won't have an allocation.
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.
Being a test case, the allocation doesn't matter.
|
While I would prefer changing std.algorithm's strip functions and deferring to those, the interface would be the same and this is a tiny patch, so LGTM. |
|
Auto-merge toggled on |
add range support to std.string.stripLeft
|
This introduced a regression: https://issues.dlang.org/show_bug.cgi?id=14827 |
unit test coverage 100%