pub fn str_to_int(s: &SmtString) -> i32
Expand description
Convert s to an integer
- Return a non-negative integer if s consists entirely of decimal digits.
- Return -1 otherwise
§Panics
If the result is too large and does not fit in i32
.
§Examples
use aws_smt_strings::smt_strings::*;
assert_eq!(str_to_int(&SmtString::from("00982")), 982);
assert_eq!(str_to_int(&EMPTY), -1);
assert_eq!(str_to_int(&SmtString::from("101aaabb")), -1);