Mega Code Archive

 
Categories / VB.Net / Data Types
 

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