0

I currently have the ASP following code, where if a particular non-Latin character "д" appears in my search string, I get a desired response as below.

myQuery = request("myQuery")

If InStr(1, myQuery, "д", 1) > 0 then
    Response.write "Query from languages ......  detected." 
 Else 
    Response.write "Continue searching English/Latin archive."
End if

But how do I replace my single character with an array of characters:

myArray = Array("ß","ü","ş","ğ", "ä", "д", "ф")

In other words, how do I check to see if any of the characters in myArray appears in myQuery?

halfer
  • 19,824
  • 17
  • 99
  • 186
thamada
  • 3
  • 3

1 Answers1

1

Depends on the need, you either can loop through the array

For Each x In myArray 
    If InStr(1, myQuery, x, 1) > 0 then
        Response.write x + " was detected." 
    Else 
        Response.write "Continue searching English/Latin archive."
    End if
Next

or use regular expressions to test in one shot

Dim myRegExp, FoundMatch
Set myRegExp = New RegExp
myRegExp.Pattern = "[ßüşğäдф]"
FoundMatch = myRegExp.Test(myQuery)

If FoundMatch then
    Response.write "Characters detected." 
Else 
    Response.write "Continue searching English/Latin archive."
End if
user2316116
  • 6,726
  • 1
  • 21
  • 35