String: Substring, LastIndexOf
Imports System
Imports System.Collections
Public Class MainClass
Shared Sub Main(ByVal args As String())
Dim s1 As String = "One Two Three Four"
Dim index As Integer
index = s1.LastIndexOf(" ")
Dim s2 As String = s1.Substring((index + 1))
s1 = s1.Substring(0, index)
index = s1.LastIndexOf(" ")
Dim s3 As String = s1.Substring((index + 1))
s1 = s1.Substring(0, index)
index = s1.LastIndexOf(" ")
Dim s4 As String = s1.Substring((index + 1))
s1 = s1.Substring(0, index)
index = s1.LastIndexOf(" ")
Dim s5 As String = s1.Substring((index + 1))
Console.WriteLine("s1: {0}", s1)
Console.WriteLine("s2: {0}", s2)
Console.WriteLine("s3: {0}", s3)
Console.WriteLine("s4: {0}", s4)
Console.WriteLine("s5: {0}", s5)
End Sub
End Class
Related examples in the same category