Skip to content

Instantly share code, notes, and snippets.

@ilyabrin
Created December 22, 2015 22:54
Show Gist options
  • Select an option

  • Save ilyabrin/b929853fc36a87e1f2c1 to your computer and use it in GitHub Desktop.

Select an option

Save ilyabrin/b929853fc36a87e1f2c1 to your computer and use it in GitHub Desktop.
String utils - Strip slashes
package main
import (
"fmt"
"strings"
)
func main() {
// use backtick ` instead of double quote "
str := `Is your name O\'reilly?`
fmt.Println(str)
stripSlash := strings.Replace(str, "\\", "", -1)
fmt.Println(stripSlash)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment