parse

stdlib::rss::parse

Validated integer and boolean parsing helpers.

Import

use stdlib::rss::parse;

Functions

FunctionDescription
is_int_literal_baseReturns whether a string is a valid integer literal for the given base.
is_int_literalReturns whether a string is a base-10 integer literal.
try_parse_int_baseParses an integer literal for the given base and returns null on failure.
try_parse_intParses a base-10 integer literal and returns null on failure.
parse_int_base_orParses an integer literal for the given base or returns a fallback.
parse_int_orParses a base-10 integer literal or returns a fallback.
is_bool_literalReturns whether a string is a boolean literal.
try_parse_boolParses a boolean literal and returns null on failure.
parse_bool_orParses a boolean literal or returns a fallback.

Function details

is_int_literal_base

pub fn is_int_literal_base(value: string, base: int) -> bool

Returns whether a string is a valid integer literal for the given base.

is_int_literal

pub fn is_int_literal(value: string) -> bool

Returns whether a string is a base-10 integer literal.

try_parse_int_base

pub fn try_parse_int_base(value: string, base: int) -> int?

Parses an integer literal for the given base and returns null on failure.

try_parse_int

pub fn try_parse_int(value: string) -> int?

Parses a base-10 integer literal and returns null on failure.

parse_int_base_or

pub fn parse_int_base_or(value: string, base: int, fallback: int) -> int

Parses an integer literal for the given base or returns a fallback.

parse_int_or

pub fn parse_int_or(value: string, fallback: int) -> int

Parses a base-10 integer literal or returns a fallback.

is_bool_literal

pub fn is_bool_literal(value: string) -> bool

Returns whether a string is a boolean literal.

try_parse_bool

pub fn try_parse_bool(value: string) -> bool?

Parses a boolean literal and returns null on failure.

parse_bool_or

pub fn parse_bool_or(value: string, fallback: bool) -> bool

Parses a boolean literal or returns a fallback.