Created
December 22, 2015 22:54
-
-
Save ilyabrin/b929853fc36a87e1f2c1 to your computer and use it in GitHub Desktop.
String utils - Strip slashes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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