Skip to content
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

strings: TrimLeft bug if cutset contains .h #5622

Closed
gopherbot opened this issue Jun 3, 2013 · 1 comment
Closed

strings: TrimLeft bug if cutset contains .h #5622

gopherbot opened this issue Jun 3, 2013 · 1 comment

Comments

@gopherbot
Copy link

by victorvieux:

When the cutset of strings.TrimLeft() contains ".h", all the leading h are
removed.

What steps will reproduce the problem?
http://play.golang.org/p/bTtOmZiVpp

What is the expected output?
.wh.httpd httpd
.wh.chown chown
.wh.hhhhh hhhhh


What do you see instead?
.wh.httpd ttpd
.wh.chown chown
.wh.hhhhh 


Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OS

Which version are you using?  (run 'go version')
go1.1 darwin/amd64
@remyoudompheng
Copy link
Contributor

Comment 1:

TrimLeft does not remove a prefix, it removes all runes specified by the cutset.
http://golang.org/pkg/strings/#TrimLeft
Use TrimPrefix instead.

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants