MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / IsHexNumber

Function IsHexNumber

src/utilstrencodings.cpp:69–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

HexDigitFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68