let mut base = 10; println!('1'.is_digit(base)); // true println!('f'.is_digit(base)); // false // base = 10 is probably what you're looking for base = 16 println!('f'.is_digit(base)); // true println!('g'.is_digit(base)); // false