LastIndexOf to find a character in a string
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("LastIndexOf to find a character in a string")
Console.WriteLine("Last ""c"" is located at " & _
"index " & letters.LastIndexOf("c"c))
Console.WriteLine("Last ""a"" is located at index " & _
letters.LastIndexOf("a"c, 25))
Console.WriteLine("Last ""$"" is located at index " & _
letters.LastIndexOf("$"c, 15, 5))
End Sub ' Main
End Class
Related examples in the same category