Namespace: joker.strconv
v1.0Contents
Summary
Implements conversions to and from string representations of basic data types.
Index
 atoi
 canbackquote?
 formatbool
 formatdouble
 formatint
 graphic?
 itoa
 parsebool
 parsedouble
 parseint
 printable?
 quote
 quotechar
 quotechartoascii
 quotechartographic
 quotetoascii
 quotetographic
 unquote
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.
(None.)
Variables

(None.)
Functions, Macros, and Special Forms

atoi
Function v1.0(atoi s)
Equivalent to (parseint s 10 0).

canbackquote?
Function v1.0(canbackquote? s)
Reports whether the string s can be represented unchanged as a singleline backquoted string without control characters other than tab.

formatbool
Function v1.0(formatbool b)
Returns "true" or "false" according to the value of b.

formatdouble
Function v1.0(formatdouble f fmt prec bitSize)
Converts the floatingpoint 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 floatingpoint value of bitSize bits (32 for float32, 64 for float64).
The format fmt is one of 'b' (ddddp±ddd, a binary exponent), 'e' (d.dddde±dd, a decimal exponent), 'E' (d.ddddE±dd, a decimal exponent), 'f' (ddd.dddd, no exponent), 'g' ('e' for large exponents, 'f' otherwise), or 'G' ('E' for large exponents, 'f' otherwise).
The precision prec controls the number of digits (excluding the exponent) printed by the 'e', 'E', 'f', 'g', and 'G' formats. For 'e', 'E', and 'f' it is the number of digits after the decimal point. For 'g' and 'G' it is the maximum number of significant digits (trailing zeros are removed). The special precision 1 uses the smallest number of digits necessary such that ParseFloat will return f exactly. 
formatint
Function v1.0(formatint i base)
Returns the string representation of i in the given base, for 2 <= base <= 36. The result uses the lowercase letters 'a' to 'z' for digit values >= 10.

graphic?
Function v1.0(graphic? c)
Reports whether the char 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.

itoa
Function v1.0(itoa i)
Equivalent to (formatint i 10).

parsebool
Function v1.0(parsebool s)
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.

parsedouble
Function v1.0(parsedouble s)
Converts the string s to a floatingpoint number.

parseint
Function v1.0(parseint s base bitSize)
Interprets a string s in the given base (0, 2 to 36) and bit size (0 to 64) and returns the corresponding value i.
If base == 0, the base is implied by the string's prefix: base 16 for "0x", base 8 for "0", and base 10 otherwise. For bases 1, below 0 or above 36 an error is returned.
The bitSize argument specifies the integer type that the result must fit into. Bit sizes 0, 8, 16, 32, and 64 correspond to int, int8, int16, int32, and int64. For a bitSize below 0 or above 64 an error is returned. 
printable?
Function v1.0(printable? c)
Reports whether the char is defined as printable by Joker: letters, numbers, punctuation, symbols and ASCII space.

quote
Function v1.0(quote s)
Returns a doublequoted string literal representing s. The returned string uses escape sequences (\t, \n, \xFF, \u0100)
for control characters and nonprintable characters as defined by printable?. 
quotechar
Function v1.0(quotechar c)
Returns a singlequoted char literal representing the character. The returned string uses escape sequences (\t, \n, \xFF, \u0100)
for control characters and nonprintable characters as defined by printable?. 
quotechartoascii
Function v1.0(quotechartoascii c)
Returns a singlequoted char literal representing the character. The returned string uses escape sequences (\t, \n, \xFF, \u0100)
for nonASCII characters and nonprintable characters as defined by printable?. 
quotechartographic
Function v1.0(quotechartographic c)
Returns a singlequoted char literal representing the character. The returned string uses escape sequences (\t, \n, \xFF, \u0100)
for nonASCII characters and nonprintable characters as defined by graphic?. 
quotetoascii
Function v1.0(quotetoascii s)
Returns a doublequoted string literal representing s. The returned string uses escape sequences (\t, \n, \xFF, \u0100)
for nonASCII characters and nonprintable characters as defined by printable?. 
quotetographic
Function v1.0(quotetographic s)
Returns a doublequoted string literal representing s. The returned string uses escape sequences (\t, \n, \xFF, \u0100)
for nonASCII characters and nonprintable characters as defined by graphic?. 
unquote
Function v1.0(unquote s)
Interprets s as a singlequoted, doublequoted, or backquoted string literal, returning the string value that s quotes.
(If s is singlequoted, it would be a Go character literal; Unquote returns the corresponding onecharacter string.)