You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Not Sure
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
Usually we use strings.TrimLeft to trim some fixed prefix, however when exec strings.TrimLeft("./csv/visitor.csv", "./csv/"), the EXPECTED result is "vistor.csv", the REAL result is "istor.csv".
TrimLeft returns a slice of the string s with all leading Unicode code points contained in cutset removed.
To remove a prefix, use TrimPrefix instead.
The TrimLeft function is removing every character from the cutest from the start of the string whereas what you’re looking is what TrimPrefix does, which is to remove a fixed prefix from the string.
TrimLeft returns a slice of the string s with all leading Unicode code points contained in cutset removed.
To remove a prefix, use TrimPrefix instead.
The TrimLeft function is removing every character from the cutest from the start of the string whereas what you’re looking is what TrimPrefix does, which is to remove a fixed prefix from the string.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not Sure
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Usually we use strings.TrimLeft to trim some fixed prefix, however when exec strings.TrimLeft("./csv/visitor.csv", "./csv/"), the EXPECTED result is "vistor.csv", the REAL result is "istor.csv".
It's amazing.
https://play.golang.com/p/EeY2DKiWeRR
What did you expect to see?
----------a-----------
./csv/visitor.csv
visitor.csv
----------b-----------
./csv/visitor.csv
visitor.csv
----------c-----------
./csv/visitor.csv
csv/visitor.csv
What did you see instead?
----------a-----------
./csv/visitor.csv
isitor.csv
----------b-----------
./csv/visitor.csv
isitor.csv
----------c-----------
./csv/visitor.csv
csv/visitor.csv
The text was updated successfully, but these errors were encountered: