parse
stdlib::rss::parse
Validated integer and boolean parsing helpers.
Import
use stdlib::rss::parse;
Functions
| Function | Description |
|---|---|
is_int_literal_base | Returns whether a string is a valid integer literal for the given base. |
is_int_literal | Returns whether a string is a base-10 integer literal. |
try_parse_int_base | Parses an integer literal for the given base and returns null on failure. |
try_parse_int | Parses a base-10 integer literal and returns null on failure. |
parse_int_base_or | Parses an integer literal for the given base or returns a fallback. |
parse_int_or | Parses a base-10 integer literal or returns a fallback. |
is_bool_literal | Returns whether a string is a boolean literal. |
try_parse_bool | Parses a boolean literal and returns null on failure. |
parse_bool_or | Parses 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.