C language IsDigit () function: To determine whether a character is an Arabic numeral
header file:
To define a function:
Function Description: Check whether the parameter C is Arabic numerals 0 to 9.
Return value: Returns true if parameter C is Arabic, otherwise null (0).
Additional description: This is a macro definition, not a true function.
Example: Find the characters in the STR string that are Arabic numerals.
#include <ctype.h>
Main () {
char str[] = "123@ #FDsP [E?";
int i;
for (i = 0; Str[i]!= 0; i++)
if (IsDigit (str[i)))
printf ("%c be an digit character\n", str[i));
Execution results:
1 is a digit character
2 is a digit character
3 is a digit character
C language Isxdigit () function: To determine whether a character is a 16 binary number
Header file:
To define a function:
Function Description: Check whether the parameter C is a 16 binary number, as long as C is one of the following conditions to detect success.
16 binary number: 0123456789ABCDEF.
Return value: If parameter C is a 16-digit number, it returns a non-0, otherwise it returns 0.
Additional description: This is a macro definition, not a true function.
Example: finds characters in string str that are hexadecimal digits.
#include <ctype.h>
Main () {
char str[] = "123c@ #FDsP [E?";
int i;
for (i = 0; Str[i]!= 0; i++)
if (Isxdigit (str[i)))
printf ("%c be a hexadecimal digits\n", str[i]);
Execution results:
1 is a hexadecimal digits
2 are a hexadecimal digits
3 is a hexadecimal digits
c is a hexadecimal DIGITS
f is a hexadecimal digits
D are a hexadecimal digits
e is a hexadecimal digits