Capy-Bearer Documentation

s64

lib call

Capy

function s64(value : as string, opt : dval = {}) s64

s64() converts the exact text from value. It uses base 10 unless opt.base selects another integer base. opt.fallback is the result for empty text or text that does not parse. It defaults to 0.

value accepts scalar values through as string. The conversion keeps scalar text exact. Empty and missing dval values both convert to empty text. Use value? before conversion when presence matters. An empty value is present, but a missing value is not.

The options map accepts only fallback and base. An unknown key is an error.

Parameters

value : scalar value or text to convert

opt : options map with fallback and base

Return Values

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

Example

Capy

print(s64("2a", {base: 16, fallback: -1}), "\n")