Examples using... "strconv"
Recent
UnquoteChar decodes the first character or byte in the escaped string
or character literal represented by the string s.
It returns four values:
Unquote interprets s as a single-quoted, double-quoted,
or backquoted Go string literal, returning the string value
that s quotes. (If s is single-quoted, it would be a Go
character literal; Unquote returns the corresponding
one-character string.)
QuoteToGraphic returns a double-quoted Go string literal representing s.
The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for
non-ASCII characters and non-printable characters as defined by IsGraphic.
QuoteToASCII returns a double-quoted Go string literal representing s.
The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for
non-ASCII characters and non-printable characters as defined by IsPrint.
QuoteRuneToGraphic returns a single-quoted Go character literal representing
the rune. The returned string uses Go escape sequences (\t, \n, \xFF,
\u0100) for non-ASCII characters and non-printable characters as defined
by IsGraphic.
QuoteRuneToASCII returns a single-quoted Go character literal representing
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.
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.
Quote returns a double-quoted Go string literal representing s. The
returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for
control characters and non-printable characters as defined by
IsPrint.
ParseUint is like ParseInt but for unsigned numbers.
ParseInt interprets a string s in the given base (0, 2 to 36) and
bit size (0 to 64) and returns the corresponding value i.
ParseFloat converts the string s to a floating-point number
with the precision specified by bitSize: 32 for float32, or 64 for float64.
When bitSize=32, the result still has type float64, but it will be
convertible to float32 without changing its value.
ParseBool returns the boolean value represented by the string.
It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False.
Any other value returns an error.
A NumError records a failed conversion.
Itoa is equivalent to FormatInt(int64(i), 10).
IsPrint reports whether the rune is defined as printable by Go, with
the same definition as unicode.IsPrint: letters, numbers, punctuation,
symbols and ASCII space.
IsGraphic reports whether the rune is defined as a Graphic by Unicode. Such
characters include letters, marks, numbers, punctuation, symbols, and
spaces, from categories L, M, N, P, S, and Zs.
FormatUint returns the string representation of i in the given base,
for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z'
for digit values >= 10.
FormatInt returns the string representation of i in the given base,
for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z'
for digit values >= 10.
FormatFloat converts the floating-point number f to a string,
according to the format fmt and precision prec. It rounds the
result assuming that the original was obtained from a floating-point
value of bitSize bits (32 for float32, 64 for float64).
FormatBool returns "true" or "false" according to the value of b.
CanBackquote reports whether the string s can be represented
unchanged as a single-line backquoted string without control
characters other than tab.
Atoi is equivalent to ParseInt(s, 10, 0), converted to type int.
AppendUint appends the string form of the unsigned integer i,
as generated by FormatUint, to dst and returns the extended buffer.
AppendQuoteToASCII appends a double-quoted Go string literal representing s,
as generated by QuoteToASCII, to dst and returns the extended buffer.
AppendQuoteRuneToASCII appends a single-quoted Go character literal representing the rune,
as generated by QuoteRuneToASCII, to dst and returns the extended buffer.
AppendQuoteRune appends a single-quoted Go character literal representing the rune,
as generated by QuoteRune, to dst and returns the extended buffer.
AppendQuote appends a double-quoted Go string literal representing s,
as generated by Quote, to dst and returns the extended buffer.
AppendInt appends the string form of the integer i,
as generated by FormatInt, to dst and returns the extended buffer.
AppendFloat appends the string form of the floating-point number f,
as generated by FormatFloat, to dst and returns the extended buffer.
AppendBool appends "true" or "false", according to the value of b,
to dst and returns the extended buffer.