Problem with using the "Like"-Operator.

J

Joepy

Hi, I have just encountered a very strange problem when comparing
strings:

Here is an example:

If "10" Like "[7,8,9,10,11]" Then
MsgBox "Found!"
Else
MsgBox "Not found!"
End If

The result is "Not found", although it should find the 10 inside the
other string. The strange thing is it finds 7,8 and 9, but not the
two-digit numbers.

How can I get this to work?
Any help is appreciated.
Regards,
Markus
 
K

Kostis Vezerides

Markus,
the order of the operands is important. Also you need the
wildcards:

If "[7,8,9,10,11]" Like "*10*" Then
MsgBox "Found!"
Else
MsgBox "Not found!"
End If

HTH
Kostis
 
Top