I get the output:
Hello World
Hello
With the following code:
package main
import(
"fmt"
"strings"
)
func main(){
s := "Hello World"
fmt.Println(strings.NewReplacer("Hello","").Replace(s))
fmt.Println(strings.NewReplacer("World","").Replace(s))
}
Is this a bug? Is there a better way to remove substrings?