DEV Community

Clavin June
Clavin June

Posted on • Originally published at clavinjune.dev on

Golang Escape Double Quoted String Easily

Sunday Snippet #18 golang escape double quoted string easily

main.go

package main import . "fmt" func main() { Printf("%q", `"foobar"`) } 
Enter fullscreen mode Exit fullscreen mode

run go

$ go run main.go "\"foobar\"" 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)