Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::isxdigit

 

std::isxdigit is an STL function to test of a character is a hexadecimal digit.

 

#include <cassert>
#include <string>

int main()
{
  const std::string s = "1a";

  //'a' is no decimal digit
  assert( std::isdigit(s[0]));
  assert(!std::isdigit(s[1]));

  //'a' is a hexadecimal digit
  assert( std::isxdigit(s[0]));
  assert( std::isxdigit(s[1]));
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict