LastIndexOfAny to find first occurrence of character in array
Imports System
Public Class MainClass
Shared Sub Main()
Dim letters As String = "abcdefghijklmabcdefghijklm"
Dim searchLetters As Char() = New Char() {"c"c, "a"c, "$"c}
Console.WriteLine("LastIndexOfAny to find first occurrence of character in array")
Console.WriteLine("Last occurrence of ""c""," & _
" ""a"" or ""$"" is located at " & _
letters.LastIndexOfAny(searchLetters))
Console.WriteLine("Last occurrence of ""c"", ""a"" or " & _
"""$"" is located at " & _
letters.LastIndexOfAny(searchLetters, 1))
Console.WriteLine("Last occurrence of ""c"", ""a"" or " & _
"""$"" is located at " & _
letters.LastIndexOfAny(searchLetters, 25, 5))
End Sub ' Main
End Class
Related examples in the same category