Golang Escape Double Quoted String Easily

sunday-snippet · May 22, 2022 · ~1 min
Sunday Snippet #18 golang escape double quoted string easily
Sunday Snippet #18 golang escape double quoted string easily

main.go

1
2
3
4
5
6
7
package main

import . "fmt"

func main() {
	Printf("%q", `"foobar"`)
}

run go

1
2
$ go run main.go
"\"foobar\""
· · ·

Love This Content?

Any kind of supports is greatly appreciated! Kindly support me via Bitcoin, Ko-fi, Trakteer, or just continue to read another content. You can write a response via Webmention and let me know the URL via Telegraph.

Drop Your Comment Below