-
numeric or alpha
Does anyone know how to find if a char is a numeric or an alpha? I know there are functions in a header to do, but I want to know how to do with out that. I remember someone posting that before but for the life of me I cant find it. I recall it could be done by changing it to its bits, then doing something to it. I hope this makes sense...I am high on cold drugs right now :D
-
Look at how the macros are defined in ctype.h
Because all characters are integers too you can compare them using >, >=, <, <=. And it's easy to find an ASCII table. Just look it up:
#define isdigit(c) ((c) >= '0' && (c) <= '9')
-
-
inline bool isdigit(unsigned char c){return c-48<=9;}