This documentation is copyright © 1998-2001 Sandro Sigala <sandro@sigala.it>.
All rights reserved.
Released under the GNU General Public License.
isxdigit
Prototype
#include <ctype.h>
int isxdigit(int c);
Description
Returns a true value if the c
character is an hexadecimal-digit character.
Example
#include <ctype.h>
/*
* Translate the hexadecimal argument string into an integer value.
*/
int hex_to_int(const char *s)
{
int i = 0;
for (; *s != '\0'; ++s) {
if (!isxdigit(*s))
return i;
i *= 16;
if (isdigit(*s))
i += *s - '0';
else
i += tolower(*s) - 'a' + 10;
}
return i;
}
References
ISO C 9899:1990 7.3.1.11