Description of the problem:
According to the spec, a negative value for count in string.replace should be ignored and this is also what python and the Go implementation do.
# Current implementation
"abc".replace("a", "z", -1) # "abc"
# Python/Go
"abc".replace("a", "z", -1) # "zbc"
Side Note: The parameter count of string.replace is incorrectly named maxsplit in the definition of replace here.
Description of the problem:
According to the spec, a negative value for
countinstring.replaceshould be ignored and this is also what python and the Go implementation do.Side Note: The parameter
countofstring.replaceis incorrectly namedmaxsplitin the definition ofreplacehere.