String module

parse_bool

procedure · 1 overloadSource

Reads the next token and reads it as true or false, in either case. The second result is false when the token is anything else or there is none; the token is removed from line anyway.

parse_bool :: (
    line: *string,
    delimiters := DEFAULT_DELIMITERS,
    spaces := DEFAULT_SPACES
) -> (value: bool, success: bool)

Parameters

line: *string
delimiters := DEFAULT_DELIMITERS
spaces := DEFAULT_SPACES

Returns

value: bool
success: bool
ExampleOpen in playground ↗
line := "True rest";
value, ok := parse_bool(*line);
assert(ok && value && line == " rest");

See also