Quick actions

cmd+k|ctrl+k

Navigation

Languages

Strings / Trim strings (remove chars or substrings) / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-08-23T17:22:45Z

Updated

2019-08-23T17:22:45Z

package main

import (
	"fmt"
	"strings"
)

func main() {
	s := "this is string"
	toRemove := " is"

    after := strings.Replace(s, toRemove, "", -1)    
	fmt.Printf("Removed %#v from %#v => %#v\n\n", toRemove, s, after)
}
INFO