;Copyright 2000 - Mark McDonald All rights reserved ; DESC: Return 1 IF all characters in string are a-z, 0 if not. ; EXAMP: Sum = isalpha(Text$) ; ISALPHA(STRING) ; Returns: ; 0 if STRING contains a character NOT A-Z (case does not matter) ; 1 if string is alpha characters A-Z ; EXAMPLE: T = ISALPHA("ASBasdf12") 0 ; T = ISALPHA("ASBasdf") 1 Extrn Get$Loc: Far Extrn Rls$Alloc: Far MCODE Segment Byte Assume CS: MCODE Public isalpha isalpha Proc Far ARG StrHandle: WORD = Retbytes push BP ; mov BP,SP ; push DS ; mov AX, StrHandle ; put string handle in AX push AX ; push it on the on stack call Get$Loc ; get location of string mov DS,DX ; put segment in DS mov SI,AX ; put offset in SI xor AX,AX ; clear AX jcxz Exit ; is string null? xor BX,BX ; clear BX ReadChar: lodsb ; load a character cmp AL, 'A' ; is it less than 'A'? jb Exit ; yes, exit cmp AL, 'Z' ; is it less than or equal to 'Z'? jbe ItsAlpha ; yes, return true cmp AL, 'a' ; is it less than 'a'? jb Exit ; yes, exit cmp AL, 'z' ; is it more than 'z'? ja Exit ; yes, exit ItsAlpha: loop ReadChar ; do it CX times mov BX,1 ; all characters are sp Exit: mov AX,BX push AX ; save return val push Word Ptr StrHandle ; push string handle call Rls$Alloc ; release string pop AX ; restore return val pop DS ; pop BP ; retf Retbytes ; isalpha EndP MCODE EndS End