If you're using VB.NET, you can use the IndexOfAny method of the String:
C#:
string s1 = "HELP ME, PLEASE!";
string s2 = " SXPT";
int i = s1.IndexOfAny(s2.ToCharArray());
if (i == -1)
Console.WriteLine("Characters not found!");
else
Console.WriteLine("Characters found at position {0}", i);
VB.NET:
Dim s1 As String = "HELP ME, PLEASE!"
Dim s2 As String = " SXPT"
Dim i As Integer = s1.IndexOfAny(s2.ToCharArray())
If i = -1 Then
Console.WriteLine("Characters not found!")
Else
Console.WriteLine("Characters found at position {0}", i)
End If
In VB6, you would have to fake it:
Dim s1 As String : s1 = "HELP ME, PLEASE!"
Dim s2 As String : s2 = " SXPT"
Dim i As Integer
Dim index As Integer
Dim found As Boolean : found = False
For i = 1 To Len(s2)
index = InStr(1, s1, Mid(s2, i, 1)
If index > 0 Then
found = True
Exit For
End If
Next
If Not found Then
Debug.Print "Characters not found!"
Else
Debug.Print "Characters found at position " & index
End If