str_isHex.c (396B)
1 #include <stdlib.h> 2 #include <string.h> 3 4 #include "str_isHex.h" 5 6 bool str_isHex(const char *subject) { 7 int i; 8 size_t l = strlen(subject); 9 for(i = 0 ; i < l ; i++) { 10 if ( 11 (subject[i] >= 'a' && subject[i] <= 'f') || 12 (subject[i] >= 'A' && subject[i] <= 'F') || 13 (subject[i] >= '0' && subject[i] <= '9') 14 ) { 15 continue; 16 } 17 return false; 18 } 19 return true; 20 }