TGC Codebase Backup



isalnum() for DB Pro by Philip

6th Sep 2003 10:37
Summary

This is a DB Pro version of the C function isalnum(). More explanation is given in the comments in the code.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem PJY - this is a function to do the same as isalnum() in C
Rem It returns a 1 if temp is either a letter of the English alphabet or a digit. If temp
Rem is not alphanumeric, zero is returned.
Rem It returns a one for numbers on the keypad as well as on the main keyboard.
Rem Normally before calling it you would precede it with a temp = scancode() command
FUNCTION isalnum(temp)

     if ((temp >= 2) AND (temp <= 11))

          EXITFUNCTION 1

     endif

     if ((temp >= 71) AND (temp <= 82))

          EXITFUNCTION 1

     endif

     if ((temp >= 16) AND (temp <= 25))

          EXITFUNCTION 1

     endif

     if ((temp >= 30) AND (temp <= 38))

          EXITFUNCTION 1

     endif

     if ((temp >= 44) AND (temp <= 50))

          EXITFUNCTION 1

     endif

ENDFUNCTION 0