-
Notifications
You must be signed in to change notification settings - Fork 18k
strings.Trim sometimes trims incorrectly #19371
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
Comments
The second argument to Trim is a set of code points, not a prefix/suffix. You probably want strings.TrimPrefix. |
Thank you, sorry. Best way to get an answer on the Internet is to be wrong :) |
This mistake is practically a FAQ. Perhaps we can clarify the docs somehow. |
The docs at least say "cutset" these days: https://golang.org/pkg/strings/#Trim And there's an example that says !!! Achtung! Achtung! !!! which is only more alarming when it's shouted at you verbally. |
I offer that people don't know what cutset means, and are left to assume
that it means "fancy word for the string I want to trim off".
…On Fri, Mar 3, 2017 at 7:57 AM, Brad Fitzpatrick ***@***.***> wrote:
The docs at least say "cutset" these days:
https://golang.org/pkg/strings/#Trim
And there's an example that says *!!! Achtung! Achtung! !!!* which is
only more alarming when it's shouted at you verbally.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19371 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA0Is4U4BSvgjLR8LSOHLQwm9wV6iks5rhy1FgaJpZM4MReBm>
.
|
Dave, totally agree. I was only saying it used to be even worse. :) |
No argument there, mind if I take a stab at improving it?
…On Fri, Mar 3, 2017 at 8:31 AM, Brad Fitzpatrick ***@***.***> wrote:
Dave, totally agree. I was only saying it used to be even worse. :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#19371 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA68B2ugh4SrhbYV7EJ6AKWukzXgcks5rhzU9gaJpZM4MReBm>
.
|
🔪🔪🔪 stab away |
Yep, exactly. I Googled code points and I didn't even think about cutset. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.8 windows/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH=amd64
What did you do?
I run this
Playground
What did you expect to see?
Output should be CMD/45465/44545
What did you see instead?
Output is MD/45465/44545
The text was updated successfully, but these errors were encountered: