MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsHexNumber

Function IsHexNumber

src/util/strencodings.cpp:71–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71bool 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
84std::vector<unsigned char> ParseHex(const char* psz)
85{

Callers 3

BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85

Calls 3

HexDigitFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68