Search string with IndexOf
Class Program
Shared Sub Main()
Dim sentence As String = "This sentence has five words."
Dim startPosition As Integer = sentence.IndexOf(" ") + 1
Dim word2 As String = sentence.Substring(startPosition, sentence.IndexOf(" ", startPosition) - startPosition)
Console.WriteLine("Second word: " + word2)
End Sub
End Class
Related examples in the same category