Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>the isxxxx macros</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The isxxxx Macros

Usage

   #include <ctype.h>
   int isalnum(int c):
   int isalpha(int c):
   int isascii(int c):
   int iscntrl(int c):
   int isdigit(int c):
   int isgraph(int c):
   int islower(int c):
   int isprint(int c):
   int ispunct(int c):
   int isspace(int c):
   int isupper(int c):
   int isxdigit(int c):

   ANSI

Description


   isalnum          Determines if a character is not a symbol, i.e. is
                    alphanumeric by table lookup. Only values of c between
                    -1 and 255 are valid. This macro is also implemented as
                    a function in the library.

   isalpha          Determines if c is a letter by table lookup. Only values
                    of c between -1 and 255 are valid. This macro is also
                    implemented as a function in the library.

   isascii          Determines if c is between 0 and 127. This macro is also
                    implemented as a function in the library.

   iscntrl          Determines if c is a control character (0 to 0x1F), or c
                    == 0x7F by table lookup. Only values of c between -1 and
                    255 are valid. This macro is also implemented as a
                    function in the library.

   isdigit          Determines if the character is a digit by table lookup.

                    Only values of c between -1 and 255 are valid. This
                    macro is also implemented as a function in the library.

   isgraph          Determines if c is a printing character (excluding the
                    space) by table lookup. Only values of c between -1 and
                    255 are valid. This macro is also implemented as a
                    function in the library.

   islower          Determines if character is lower case by table lookup.
                    Only values of c between -1 and 255 are valid. This
                    macro is also implemented as a function in the library.

   isprint          Determines if c is a printing character (including the
                    space) by table lookup. Only values of c between -1 and
                    255 are valid. This macro is also implemented as a
                    function in the library.

   ispunct          Determines if c is a punctuation character by table
                    lookup. Only values of c between -1 and 255 are valid.
                    This macro is also implemented as a function in the

                    library.

   isspace          Determines if character is "white space", that is, a tab,
                    line feed, vertical tab, form feed, return or space by
                    table lookup. Only values of c between -1 and 255 are
                    valid. This macro is also implemented as a function in
                    the library.

   isupper          Determines if c is an upper-case character by table
                    lookup. Only values of c between -1 and 255 are valid.
                    This macro is also implemented as a function in the
                    library.

   isxdigit         Determines if c is one of the characters 0 to 9, A to F or
                    a to f by table lookup. Only values of c between -1 and
                    255 are valid. This macro is also implemented as a
                    function in the library.

Example 

   #include <ctype.h>
   #include <stdio.h>
   #include <conio.h>
   #include <stdlib.h>

   int main()
   {
       int i;
       char *ans[2] = { "not ", "" };
       for (i = -1; i < 255; i++)
           {
           printf("\n\n\nThe value %02x is :\n");
           printf("%salphanumeric\n",ans[(isalnum(i)!=0)]);
           printf("%sa letter\n",ans[(isalpha(i)!=0)]);
           printf("%sascii\n",ans[(isascii(i)!=0)]);
           printf("%sa control\n",ans[(iscntrl(i)!=0)]);
           printf("%sa digit\n",ans[(isdigit(i)!=0)]);
           printf("%sprintable/not a space\n",ans[(isgraph(i)!=0)]);
           printf("%slower case\n",ans[(islower(i)!=0)]);

           printf("%sprintable\n",ans[(isprint(i)!=0)]);
           printf("%sa punctuator\n",ans[(ispunct(i)!=0)]);
           printf("%swhite space\n",ans[(isspace(i)!=0)]);
           printf("%supper case\n",ans[(isupper(i)!=0)]);
           printf("%sa hexadecimal digit\n",ans[(isxdigit(i)!=0)]);
           printf("* Press a key for the next value *\n");
           getch();
           }
       return EXIT_SUCCESS;
   }

Return Value

       isalnum     Returns non-zero if c is a letter or a digit.

       isalpha     Returns non-zero if c is a letter.

       isascii     Returns non-zero if c is between 0 and 127.

       iscntrl     Returns non-zero if c is a control
                   character (0 to 0x1F), or c == 0x7F.

       isdigit     Returns non-zero for the digits 0 to 9.

       isgraph     Returns non-zero if c is a printing
                   character. (excluding the space).

       islower     Returns non-zero if c is a lower-case character.

       isprint     Returns non-zero if c is a printing
                   character (including the space).

       ispunct     Returns non-zero if c is a punctuation character.

       isspace     Returns non-zero for tabs, linefeeds,
                   vertical tabs, form feeds, carriage returns
                   and spaces.

       isupper     Returns non-zero if c is an upper-case character.

       isxdigit    Returns non-zero if c is one of the
                   characters 0 to 9, A to F or a to f.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson