atoi
pub fn atoi(s &string) intPurpose
Parse a decimal string as int.
Parameters
s&string- source string (borrowed; caller keeps it; type &string)
Returns
int — a value of this type
API
#strconvNumbers and quoting: atoi/itoa, parse/format, quote/unquote, and append_*.
atoipub fn atoi(s &string) intParse a decimal string as int.
s &stringint — a value of this type
itoapub fn itoa(n int) stringFormat an int as a decimal string.
n intstring — result string
format_boolpub fn format_bool(b bool) stringFormat as bool.
b boolstring — result string
parse_boolpub fn parse_bool(s &string) boolParse as bool. Throws on failure.
s &stringbool — true or false
format_intpub fn format_int(n int, base int) stringFormat as int. Throws on failure.
n intbase intstring — result string
parsepub fn parse(s &string, base int) intParse the input. Throws on failure.
s &stringbase intint — a value of this type
format_uintpub fn format_uint(n int, base int) string===================== f64 parsing / formatting (m34) ===================== parse_float / format_float aligned with strconv.ParseFloat(s, 64) and strconv.FormatFloat(f, byte, prec, 64). All decimal<->binary conversion is done with an exact little-endian base-2^30 bignum (no float bits, no recursion); f64 is only touched at the boundary (f64(int) / int(f64) casts and ieee arithmetic), so results are correctly rounded and byte-identical with for the fixture vectors. Throws on failure.
n intbase intstring — result string
parse_uintpub fn parse_uint(s &string, base int) intParse as uint. Throws on failure.
s &stringbase intint — a value of this type
quotepub fn quote(s &string) stringQuote and escape.
s &stringstring — result string
unquotepub fn unquote(s &string) stringUnquote and unescape. Throws on failure.
s &stringstring — result string
quote_runepub fn quote_rune(r int) stringQuoteRune: single-quoted character literal. Printable Unicode is kept as UTF-8; C0/c1 and other non-ASCII-controls use \x / \u / \U. Not a full unicode.IsPrint table — runes >= 0xA0 are emitted as themselves.
r intstring — result string
is_printpub fn is_print(r int) boolWhether it is print.
r intbool — true or false
is_graphicpub fn is_graphic(r int) boolWhether it is graphic.
r intbool — true or false
quote_rune_to_asciipub fn quote_rune_to_ascii(r int) stringQuote rune to ascii.
r intstring — result string
quote_to_asciipub fn quote_to_ascii(s &string) stringQuote to ascii.
s &stringstring — result string
append_quote_to_asciipub fn append_quote_to_ascii(dst string, s &string) stringAppend quote to ascii.
dst strings &stringstring — result string
append_quote_rune_to_asciipub fn append_quote_rune_to_ascii(dst string, r int) stringAppend quote rune to ascii.
dst stringr intstring — result string
quoted_prefixpub fn quoted_prefix(s &string) stringQuoted prefix. Throws on failure.
s &stringstring — result string
can_backquotepub fn can_backquote(s &string) boolCan backquote.
s &stringbool — true or false
append_intpub fn append_int(dst string, n int, base int) stringAppend int. Throws on failure.
dst stringn intbase intstring — result string
append_uintpub fn append_uint(dst string, n int, base int) stringAppend uint. Throws on failure.
dst stringn intbase intstring — result string
append_boolpub fn append_bool(dst string, b bool) stringAppend bool.
dst stringb boolstring — result string
append_quotepub fn append_quote(dst string, s &string) stringAppend quote.
dst strings &stringstring — result string
append_quote_runepub fn append_quote_rune(dst string, r int) stringAppend quote rune.
dst stringr intstring — result string
append_floatpub fn append_float(dst string, f f64, verb int, prec int) stringAppend float. Throws on failure.
dst stringf f64verb intprec intstring — result string
format_floatpub fn format_float(f f64, verb int, prec int) stringFormatFloat(f, byte, prec, 64): verbs 'f'(102), 'e'(101), 'g'(103). Throws on failure.
f f64verb intprec intstring — result string
parse_floatpub fn parse_float(s &string) f64ParseFloat(s, 64): sign / int / fraction / exponent, plus NaN and (optionally signed) Inf / Infinity, matched case-insensitively. Throws on failure.
s &stringf64 — a value of this type