Function malachite_base::num::conversion::string::to_string::digit_to_display_byte_upper
source · [−]Expand description
Converts a digit to a byte corresponding to a numeric or uppercase alphabetic char
that
represents the digit.
Digits from 0 to 9 become bytes corresponding to char
s from ‘0’ to ‘9’. Digits from 10 to
35 become bytes representing the lowercase char
s ‘A’ to ‘Z’. Passing a digit greater than
35 gives a None
.
Worst-case complexity
Constant time and additional memory.
Examples
use malachite_base::num::conversion::string::to_string::digit_to_display_byte_upper;
assert_eq!(digit_to_display_byte_upper(0), Some(b'0'));
assert_eq!(digit_to_display_byte_upper(9), Some(b'9'));
assert_eq!(digit_to_display_byte_upper(10), Some(b'A'));
assert_eq!(digit_to_display_byte_upper(35), Some(b'Z'));
assert_eq!(digit_to_display_byte_upper(100), None);