Print percentage sign when using string formatting in Go
↳ Go
06 Mar 2020 | 1 minute read
When using String Formatting in Go, the %
sign is used to specify the type. But what if you want to include a %
sign in your print? See the code snippet below:
fmt.Printf("+%d%%", 104)
Which will have the following output:
+104%