Standard library / fmt

fmt.string-verbs

%s writes string or byte slice contents; %q prints a quoted representation; %x/%X formats bytes as hexadecimal. Width and precision normally count runes, but string %x/%X precision counts bytes. Expected stdout: 'é "é" c3a9\n'.

Formal Syntax & Structure

go syntaxgo
%s %q %x %X

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  fmt.Printf("%s %q %x\n", "é", "é", "é")}
Go Reference