2021-12-29 12:58:23 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
int isdigit(int c) {
|
|
|
|
return (unsigned)c-'0' < 10;
|
|
|
|
}
|
|
|
|
|
2021-12-29 14:21:50 +00:00
|
|
|
int isxdigit(int c) {
|
2021-12-29 15:00:26 +00:00
|
|
|
return isdigit(c) || ((unsigned)c|32)-'a' < 6;
|
2021-12-29 14:21:50 +00:00
|
|
|
}
|
|
|
|
|
2021-12-29 12:58:23 +00:00
|
|
|
int isblank(int c) {
|
|
|
|
return (c == ' ' || c == '\t');
|
|
|
|
}
|
2021-12-29 13:54:15 +00:00
|
|
|
|
|
|
|
int isspace(int c) {
|
|
|
|
return (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v');
|
|
|
|
}
|
2021-12-29 14:21:50 +00:00
|
|
|
|
2021-12-29 15:00:26 +00:00
|
|
|
int islower(int c) {
|
|
|
|
return (unsigned)c-'a' < 26;
|
|
|
|
}
|
|
|
|
|
|
|
|
int isupper(int c) {
|
|
|
|
return (unsigned)c-'A' < 26;
|
|
|
|
}
|
|
|
|
|
2021-12-29 16:54:52 +00:00
|
|
|
int isalpha(int c) {
|
|
|
|
return isupper(c) || islower(c);
|
|
|
|
}
|
|
|
|
|
2021-12-29 17:20:40 +00:00
|
|
|
int isalnum(int c) {
|
|
|
|
return isalpha(c) || isdigit(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
int iscntrl(int c) {
|
|
|
|
return (unsigned)c < 0x20 || c == 0x7f;
|
|
|
|
}
|
2021-12-29 19:29:51 +00:00
|
|
|
|
|
|
|
int isprint(int c) {
|
|
|
|
return (unsigned)c-0x20 < 0x5f;
|
|
|
|
}
|
|
|
|
|
|
|
|
int isgraph(int c) {
|
|
|
|
return (unsigned)c-0x21 < 0x5e;
|
|
|
|
}
|
2021-12-29 19:48:33 +00:00
|
|
|
|
|
|
|
int tolower(int c) {
|
|
|
|
return isupper(c) ? (c | 32) : c;
|
|
|
|
}
|
|
|
|
|
|
|
|
int toupper(int c) {
|
|
|
|
return islower(c) ? c & 0x5f : c;
|
|
|
|
}
|