Standard library / strconv

strconv.QuoteRune()

Returns a single-quoted Go rune literal; invalid rune values are represented as the replacement rune. Expected stdout: "'\\n'\n".

Formal Syntax & Structure

go syntaxgo
func QuoteRune(r rune) string

Parameters & Attributes

NameTypeDescription
rruneUnicode code point to inspect or quote.

Return Value

string

Encoded representation.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strconv")
func main() {  fmt.Println(strconv.QuoteRune('\n'))}
Go Reference