pub fn parse<T: ParseIntRadix>(s: &str, radix: u32) -> Result<T, Error>Expand description
Parse the given string as an integer in the specified radix.
§Arguments
s- The string to parse.radix- The base to use for parsing.
§Type Parameters
T- The integer type to parse. Must implementParseIntRadix.
§Examples
use brush_core::int_utils::parse;
let result: u32 = parse("42", 10)?;
assert_eq!(result, 42);
let result: u8 = parse("FF", 16)?;
assert_eq!(result, 255);