components independently and the result is parenthesized, so %f applied
to 1.2+3.4i produces (1.200000+3.400000i).
+When formatting a single integer code point or a rune string (type []rune)
+with %q, invalid Unicode code points are changed to the Unicode replacement
+character, U+FFFD, as in strconv.QuoteRune.
+
Other flags:
+ always print a sign for numeric values;
guarantee ASCII-only output for %q (%+q)
// QuoteRune returns a single-quoted Go character literal representing the
// rune. The returned string uses Go escape sequences (\t, \n, \xFF, \u0100)
// for control characters and non-printable characters as defined by IsPrint.
+// If r is not a valid Unicode code point, it is interpreted as the Unicode
+// replacement character U+FFFD.
func QuoteRune(r rune) string {
return quoteRuneWith(r, '\'', false, false)
}
// the rune. The returned string uses Go escape sequences (\t, \n, \xFF,
// \u0100) for non-ASCII characters and non-printable characters as defined
// by IsPrint.
+// If r is not a valid Unicode code point, it is interpreted as the Unicode
+// replacement character U+FFFD.
func QuoteRuneToASCII(r rune) string {
return quoteRuneWith(r, '\'', true, false)
}
// the rune. If the rune is not a Unicode graphic character,
// as defined by IsGraphic, the returned string will use a Go escape sequence
// (\t, \n, \xFF, \u0100).
+// If r is not a valid Unicode code point, it is interpreted as the Unicode
+// replacement character U+FFFD.
func QuoteRuneToGraphic(r rune) string {
return quoteRuneWith(r, '\'', false, true)
}