HaveNonEnglish + StringASCIIs

Checks if one char is within two ASCII codes or not (StringASCIIs)
Used to see if languages other than English is found, above 128, like Arabic language

Function StringASCIIs(StrText, ASCII1, ASCII2)
 ' See if all chars in StrText are between ASCII1 and ASCII2
 ' Returns 0 if none found, returns number of chars if any found
 Fou1 = 0
 For I = 1 To Len(StrText)
  If AscW(Mid(StrText, I, 1)) < ASCII1 Or AscW(Mid(StrText, I, 1)) > ASCII2 Then Fou1 = Fou1 + 1
 Next
 StringASCIIs = Fou1
End Function
Function HaveNonEnglish(StrText)
 ' Checks if string has char that is not english (ASCII 128 and above)
 HaveNonEnglish = StringASCIIs(StrText, 1, 127) > 0
End Function

StrText, ASCII1, ASCII2
Or
StrText

Views 2375 Downloads 807


ANmarAmdeen
592
Texts + Strings Classic ASP
Revisions

v1.0