//Function Name : f_Is_Alphabet
//Argument Name : as_source, Arg Type : String, Pass By : Value
//Return Type : Boolean
// True if the string only contains alphabetic characters.
// If any argument's value is NULL, function returns NULL.
//
//Description: Determines whether a string contains only alphabetic
// characters.
long ll_count=0
long ll_length
char lc_char[]
integer li_ascii
//Check parameters
If IsNull(as_source) Then
boolean lb_null
SetNull(lb_null)
Return lb_null
End If
//Get the length
ll_length = Len (as_source)
//Check for at least one character
If ll_length=0 Then
Return False
End If
//Move string into array of chars
lc_char = as_source
//Perform loop around all characters
//Quit loop if Non Alpha character is found
do while ll_count<ll_length
ll_count ++
//Get ASC code of character.
li_ascii = Asc (lc_char[ll_count])
// 'A'=65, 'Z'=90, 'a'=97, 'z'=122
if li_ascii<65 or (li_ascii>90 and li_ascii<97) or li_ascii>122 then
/* Character is Not an Alpha */
Return False
end if
loop
// Entire string is alpha.
return True
0 comments:
Post a Comment