mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
Merge pull request #3138 from chromatic/optimize-is-hex-check
Optimize IsHex() string helper function
This commit is contained in:
commit
e322525758
@ -58,12 +58,16 @@ signed char HexDigit(char c)
|
||||
|
||||
bool IsHex(const string& str)
|
||||
{
|
||||
if ((str.size() <= 0) || (str.size()%2 != 0))
|
||||
return false;
|
||||
|
||||
for(std::string::const_iterator it(str.begin()); it != str.end(); ++it)
|
||||
{
|
||||
if (HexDigit(*it) < 0)
|
||||
return false;
|
||||
}
|
||||
return (str.size() > 0) && (str.size()%2 == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<unsigned char> ParseHex(const char* psz)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user