Helper function to check if a character is a digit in the given base
| 53 | |
| 54 | // Helper function to check if a character is a digit in the given base |
| 55 | static bool isDigitInBase(char c, int base) { |
| 56 | if (base <= 10) { |
| 57 | return c >= '0' && c < ('0' + base); |
| 58 | } |
| 59 | if (c >= '0' && c <= '9') { |
| 60 | return true; |
| 61 | } |
| 62 | if (c >= 'a' && c < ('a' + base - 10)) { |
| 63 | return true; |
| 64 | } |
| 65 | if (c >= 'A' && c < ('A' + base - 10)) { |
| 66 | return true; |
| 67 | } |
| 68 | return false; |
| 69 | } |
| 70 | |
| 71 | // Helper function to convert character to digit value |
| 72 | static int charToDigit(char c) { |