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
the strings.Replace for pod shouldn't be necessary, I'd expect the replacer to work correctly, but it doesn't. Either it's buggy or i'm using it incorrectly, but I don't know what I'm doing wrong.
s := "ab"
r := strings.NewReplacer("aa", "c", "b", "a")
fmt.Println(r.Replace(s))
Basically you're expecting this to replace the "b" with "a", and then to backtrack and replace the "aa" with "c".
However, the documentation for strings.NewReplacer says "Replacements are performed in order, without overlapping matches." So I don't think your expectation is sound.
If I've misunderstood, feel free to clarify. Thanks!
I agree, in rereading my issue and looking at the variable, I now see the problem, the - after rkt isn't a dash, it's a \x2d. This goes to mangling that I'm trying to work around.
using go 1.5.1 and 1.6 on linux/x64
given this string
trying to use this function to strip out part of it. (yes, can use regex, but that's a different point)
the strings.Replace for pod shouldn't be necessary, I'd expect the replacer to work correctly, but it doesn't. Either it's buggy or i'm using it incorrectly, but I don't know what I'm doing wrong.
can duplicate with https://play.golang.org/p/p_akq9d3YW by playing with comenting out line 18
The text was updated successfully, but these errors were encountered: