| 69 | } |
| 70 | |
| 71 | bool IsHexNumber(const std::string& str) |
| 72 | { |
| 73 | size_t starting_location = 0; |
| 74 | if (str.size() > 2 && *str.begin() == '0' && *(str.begin()+1) == 'x') { |
| 75 | starting_location = 2; |
| 76 | } |
| 77 | for (const char c : str.substr(starting_location)) { |
| 78 | if (HexDigit(c) < 0) return false; |
| 79 | } |
| 80 | // Return false for empty string or "0x". |
| 81 | return (str.size() > starting_location); |
| 82 | } |
| 83 | |
| 84 | std::vector<unsigned char> ParseHex(const char* psz) |
| 85 | { |