C language provides a series of functions for character judgment and character mapping
1. Character Judgment function
Return value: If the function argument is a character type that is judged, returns true, otherwise false
A, ISALNMU () numbers or letters
B, Isalpha () Letter
C, Isblank () standard white space characters (spaces, horizontal tabs, or line breaks)
D, Iscntrl () control characters (e.g. Ctrl + B)
E, Isupper () capital letters
F, islower () lowercase letters
G, Isgraph () all printable characters except for whitespace
H, Isprint () all printable characters
I, ispunct () punctuation
J, Isspace () white space characters: spaces, newline, paper, carriage return, vertical tab, Horizontal tab, or locally defined characters
K, isdigit () Arabic numerals
L, Isxdigit () hexadecimal numeric characters
2. Character mapping function
A, ToLower () If the argument is an uppercase character, returns the corresponding lowercase character;
B, ToUpper () If the argument is lowercase, the corresponding uppercase character is returned, and no person returns the original characters
Test program
#include <stdio.h>
#include <ctype.h>
#define SPACE '
int Test ()
{
int a = 0;
Double tep;
printf ("&&&&&&\n");
while (scanf ("%lf", &tep) = = 1)
{
a++;
}
printf ("A =%d\n", a);
}
int Test1 ()
{
Char ch;
ch = getchar ();
while ((ch = getchar ())! = ' \ n ')
{
if (isalnum (CH))
Putchar (ch + 1);
Else
Putchar (CH);
ch = getchar ();
}
Putchar (CH);
return 0;
}
int main ()
{
int ret = 111;
char *str_zebos = NULL;
Str_zebos = (char *) malloc (* sizeof (char));
printf ("%d\n", * sizeof (char));
printf ("ret =%d\n", ret = Test ());
Test1 ();
return 0;
}
Character judgments and character mappings