Add support to BigUint.from_str_radix() for using _ as a visual separator

This commit is contained in:
str4d 2017-10-09 16:11:18 +01:00
parent f523b9c359
commit 720893f67b
No known key found for this signature in database
GPG Key ID: 665DBCD284F7DAFF
1 changed files with 1 additions and 0 deletions

View File

@ -243,6 +243,7 @@ impl Num for BigUint {
b'0'...b'9' => b - b'0', b'0'...b'9' => b - b'0',
b'a'...b'z' => b - b'a' + 10, b'a'...b'z' => b - b'a' + 10,
b'A'...b'Z' => b - b'A' + 10, b'A'...b'Z' => b - b'A' + 10,
b'_' => continue,
_ => u8::MAX, _ => u8::MAX,
}; };
if d < radix as u8 { if d < radix as u8 {