u16
lib callCapy
function u16(value : bool, opt : any = {}) u16
function u16(value : any, opt : any = {}) u16
function u16(value : as string, opt : any = {}) u16u16() parses text in the range 0 through 65535. Invalid, negative, or out-of-range text returns opt.fallback. The default fallback is 0.
An any value that holds a number converts without text when the base is 10. The result is the same as the result for the text of that number. true converts to 1 and false to 0, also inside an any.
A one-argument numeric conversion truncates floats toward zero and returns 0 for out-of-range or nonfinite inputs. Out-of-range integer literals fail compilation.
Text parsing follows the u64 rules, including whitespace trimming and decimal fractions. base must be a numeric whole value from 2 through 36. Do not include a 0x prefix for base 16. For example, u16("65536", fallback: 7) returns 7.
print(u16("ffff", base: 16), "\n")
Output
65535Parameters
value : scalar value or text to convert
opt : options map with fallback and base
Return Values
An unsigned 16-bit integer, or opt.fallback.