diff --git a/src/u256.rs b/src/u256.rs index b519bb2..3e4d167 100644 --- a/src/u256.rs +++ b/src/u256.rs @@ -122,7 +122,7 @@ impl U256 { pub fn from_string(string: &str) -> Result { let mut value = U256::ZERO; - for chr in string.chars() { + for chr in string.chars().filter(|c| *c != '_') { let digit = chr.to_digit(10); if let Some(dig) = digit { let (value_x_8, value_x_2) = (value << 3, value << 1); @@ -178,7 +178,7 @@ impl U256 { _ => 0, }; - for chr in string.chars().skip(skip) { + for chr in string.chars().skip(skip).filter(|c| *c != '_') { let digit = chr.to_digit(radix); if let Some(dig) = digit { diff --git a/src/u512.rs b/src/u512.rs index 29c9b47..3d12856 100644 --- a/src/u512.rs +++ b/src/u512.rs @@ -1855,7 +1855,8 @@ mod test { assert_eq!(a % b, "229622695252588468980047866375".parse::()?); let a = "3912093812908391208428194902184908123982189742178629873982173391238912".parse::()?; - let b = "940899340494892899287232134329048329473287439824732982141".parse::()?; + let b = "940899340494892899287232134329048329473287439824732982141" + .parse::()?; let c = a % b; assert_eq!(