;Copyright 2000 - Mark McDonald All rights reserved ; DECLARE: FUNCTION iscan(BYVAL string) AS INTEGER ; DESC: Returns true if passed character is alpha or numeric. ; EXAMP: IF iscan(INKEY$) THEN PRINT "AlphaNumeric character" ; Returns 1 if inkey$ is alphanumeric 0 if not ; ISCAN(STRING) ; Is Character Alphanumeric. ; Returns 1 if character STRING is an alphanumeric character ; (a-z,A-z,0-9). ; Returns 0 if not. ; EXAMPLE: T = ISCAN("\") 0 Extrn Get$Loc: Far Extrn Rls$Alloc: Far mString Segment Byte Public Assume CS: mString Public iscan iscan Proc Far ARG ChrString: WORD = Retbytes push BP ; mov BP,SP ; push DS ; push Word Ptr ChrString ; push string handle call Get$Loc ; find string location mov DS,DX ; put segment in DS mov SI,AX ; put offset in SI xor AX,AX ; assume no match jcxz Exit ; is string null? mov BL,DS: [SI] ; get first character cmp BL,'0' ; is it less than '0'? jb Done ; yes, exit cmp BL,'9' ; is it less than or equal to '9'? jbe ItsAlNum ; yes, return true cmp BL,'A' ; is it less than 'A'? jb Done ; yes, exit cmp BL,'Z' ; is it less than or equal to 'Z'? jbe ItsAlNum ; yes, return true cmp BL,'a' ; is it less than 'a'? jb Done ; yes, exit cmp BL,'z' ; is it more than 'z'? ja Done ; yes, exit ItsAlNum: inc AX ; return 1 Done: push AX ; save return val push Word Ptr ChrString ; push string handle call Rls$Alloc ; release string pop AX ; restore return val Exit: pop DS ; pop BP ; retf Retbytes ; iscan EndP mString EndS End