-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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.trim() is a bug????? #36315
Comments
https://play.golang.org/p/C_SuAmJkyH0
b) when trying to trim the left side with
this is not exactly how it's implemented, the |
https://play.golang.org/p/fm4KMPuYOgH The second argument to string.Trim is a set(cut set) not a single string. |
As it was explained above, this is working as intended. You can use TrimSuffix for trimming whole substrings. Closing here, since this is not a bug and your question has been answered. |
is it should be
??? |
func strTrim () {
str := "wrong repayment time. "
resp := strings.Trim(str, "rpc error: code ")
fmt.Println(resp)
}
output: wrong repayment time.
BUT
func strTrim () {
str := "wrong repayment time. "
resp := strings.Trim(str, "rpc error: code = Unknown desc =")
fmt.Println(resp)
}
output:g repayment time.
What is it? why?????
The text was updated successfully, but these errors were encountered: