Using String searching methods: IndexOf
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(" test IndexOf to locate a character in a string")
Console.WriteLine("""c"" is located at index " & _
letters.IndexOf("c"c) )
Console.WriteLine("""a"" is located at index " & _
letters.IndexOf("a"c, 1) )
Console.WriteLine("""$"" is located at index " & _
letters.IndexOf("$"c, 3, 5) )
End Sub ' Main
End Class
Related examples in the same category