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)
5858 return p_util_hexdigit[(unsigned char )c];
5959}
6060
61- bool IsHex (const std::string& str)
61+ bool IsHex (std::string_view str)
6262{
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 ;
6765 }
6866 return (str.size () > 0 ) && (str.size ()%2 == 0 );
6967}
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ std::vector<unsigned char> ParseHex(std::string_view str);
5959signed char HexDigit (char c);
6060/* Returns true if each character in str is a hex character, and has an even
6161 * number of hex digits.*/
62- bool IsHex (const std::string& str);
62+ bool IsHex (std::string_view str);
6363/* *
6464* Return true if the string is a hex number, optionally prefixed with "0x"
6565*/
You can’t perform that action at this time.
0 commit comments