Standard library / strconv
strconv.QuoteToGraphic()
Returns a double-quoted Go literal retaining Unicode graphic runes where possible, escaping other characters as needed. Expected stdout: '"é\\n"\n'.
Formal Syntax & Structure
go syntaxgo
func QuoteToGraphic(s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text to parse, inspect or quote. |
Return Value
string
Encoded representation.
Working Example
Example Snippetgo
package main
import ( "fmt" "strconv")
func main() { fmt.Println(strconv.QuoteToGraphic("é\n"))}