File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -58,12 +58,10 @@ signed char HexDigit(char c)
58
58
return p_util_hexdigit[(unsigned char )c];
59
59
}
60
60
61
- bool IsHex (const std::string& str)
61
+ bool IsHex (std::string_view str)
62
62
{
63
- for (std::string::const_iterator it (str.begin ()); it != str.end (); ++it)
64
- {
65
- if (HexDigit (*it) < 0 )
66
- return false ;
63
+ for (char c : str) {
64
+ if (HexDigit (c) < 0 ) return false ;
67
65
}
68
66
return (str.size () > 0 ) && (str.size ()%2 == 0 );
69
67
}
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ std::vector<unsigned char> ParseHex(std::string_view str);
59
59
signed char HexDigit (char c);
60
60
/* Returns true if each character in str is a hex character, and has an even
61
61
* number of hex digits.*/
62
- bool IsHex (const std::string& str);
62
+ bool IsHex (std::string_view str);
63
63
/* *
64
64
* Return true if the string is a hex number, optionally prefixed with "0x"
65
65
*/
You can’t perform that action at this time.
0 commit comments