How can I change a hex character, not string, into a numerical value?
While typing this question, I found many answers on how to convert hex strings to values. Howe
Something like the following?
//! \return
//! The numeric value of ch, if it is hex, otherwise -1
int
fromHexChar( char ch )
{
static char const hexChars[] = "0123456789ABCDEF";
char const* p = std::find( begin( hexChars ), end( hexChars ),
::tolower( (unsigned char)ch ) );
return p == end( hexChars )
? -1
: p - begin( hexChars );
}