Capy-Bearer Documentation

s8

lib call

Capy

function s8(value : as string, opt : any = {}) s8

s8() parses text in the range -128 through 127. It uses base 10 unless opt.base selects another integer base. Invalid or out-of-range text returns opt.fallback. The default fallback is 0.

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 s64 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, s8("128", fallback: 7) returns 7.

print(s8("7f", base: 16), "\n")

Output

127

Parameters

value : scalar value or text to convert

opt : options map with fallback and base

Return Values

A signed 8-bit integer, or opt.fallback.