Function parse_string_u256

Source
pub fn parse_string_u256(u256_str: &str) -> Result<U256, TypeError>
Expand description

Parses a string into a U256, accepting both decimal and hex (prefixed with “0x”) formats.

§Examples

use primitive_types::U256;
use neo3::neo_types::parse_string_u256;
let decimal = "123456789";
assert_eq!(parse_string_u256(decimal).unwrap(), U256::from(123456789));

let hex = "0x75bcd15";
assert_eq!(parse_string_u256(hex).unwrap(), U256::from(123456789));