Function SaveAlpha(pStr As String) As String
'*******************************************
'Purpose: Removes non-alpha characters from
' a string
'Coded by: raskew
'Calls: Function IsAlpha()
'Inputs: ? SaveAlpha(" t#he *qu^i5ck !b@r#o$w&n fo#x ")
'Output: the quick brown fox
'Note: As written, empty spaces are ignored.
'*******************************************
Dim strHold As String
Dim intLen As Integer, n As Integer
strHold = Trim(pStr)
intLen = Len(strHold)
n = 1
Do
If Mid(strHold, n, 1) <> " " And Not IsAlpha(Mid(strHold, n, 1)) Then
strHold = Left(strHold, n - 1) + Mid(strHold, n + 1)
n = n - 1
End If
n = n + 1
Loop Until Mid(strHold, n, 1) = ""
SaveAlpha = strHold
End Function
Function IsAlpha(strIn As String) As Boolean
'*******************************************
'Purpose: Determine if a character is alpha
' i.e. "a" - "z" or "A" - "Z"
'Inputs: ? IsAlpha("4"),
'Output: False
'*******************************************
Dim i As Integer
i = Switch(Asc(strIn) > 122 Or Asc(strIn) < 65, 1, _
InStr("91 92 93 94 95 96", Asc(strIn)) > 0, 2, _
True, 3)
IsAlpha = IIf(i = 3, True, False)
End Function