τau /

strconv

module
strconv = import("strconv")

strconv - conversions between strings and numbers.

The int() and float() builtins convert without complaining: int("abc") is 0. These functions return an error instead, so that a parser can tell a real zero from garbage.

ParseInt = fn(s, base)source

ParseInt interprets s in the given base (2 to 36) and returns its value, or an error if s is not a whole number in that base.

Atoi = fn(s)source

Atoi is ParseInt in base 10.

ParseFloat = fn(s)source

ParseFloat returns the value of s as a float, or an error if s is not a number. It accepts the forms 12, 12.5, .5 and -12.5.

FormatFloat = fn(f, prec)source

FormatFloat returns f written with prec digits after the point. A negative prec gives the shortest representation that reads back as the same value, which is what string(f) does.

Itoa = fn(i)source

Itoa returns the decimal representation of the integer i.

FormatInt = fn(i, base)source

FormatInt returns the representation of i in the given base (2 to 36).