home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 24
/
CD_ASCQ_24_0995.iso
/
vrac
/
homonlib.zip
/
ISALPHA.BAS
< prev
next >
Wrap
BASIC Source File
|
1995-04-13
|
1KB
|
34 lines
DEFINT A-Z
' $INCLUDE: 'TRUEFALS.INC'
DECLARE FUNCTION IsAlpha (text$)
FUNCTION IsAlpha (text$)
'****************************************************************************
'Returns TRUE if the text contains only letters and spaces, otherwise FALSE.
'****************************************************************************
IF text$ = "" THEN 'If text$ is a null string,
IsAlpha = TRUE 'return TRUE (What the heck,
EXIT FUNCTION 'it's not numeric!)
END IF
allowed$ = " ABCDEFGHIJKLMNOPQRSTUVWXYZ" 'Define the allowed characters.
'(The space is there on purpose)
FOR x = 1 TO LEN(text$)
'Go through text$ one character
c$ = UCASE$(MID$(text$, x, 1)) 'at a time (upper case).
IF INSTR(allowed$, c$) = 0 THEN 'If any character does not
IsAlpha = FALSE 'appear within allowed$, it is
EXIT FUNCTION 'not alpha.
END IF
NEXT x
IsAlpha = TRUE 'All tests passed to get here.
END FUNCTION