Function malachite_base::num::conversion::string::to_string::digit_to_display_byte_lower
source · pub const fn digit_to_display_byte_lower(b: u8) -> Option<u8>
Expand description
Converts a digit to a byte corresponding to a numeric or lowercase 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_lower;
assert_eq!(digit_to_display_byte_lower(0), Some(b'0'));
assert_eq!(digit_to_display_byte_lower(9), Some(b'9'));
assert_eq!(digit_to_display_byte_lower(10), Some(b'a'));
assert_eq!(digit_to_display_byte_lower(35), Some(b'z'));
assert_eq!(digit_to_display_byte_lower(100), None);