Module Module1
Sub Main()
' The file system path we need to split
Dim s AsString = "C:\Users\Sam\Documents\Perls\Main"' Split the string on the backslash character
Dim parts AsString() = s.Split(NewChar() {"\"c})
' Loop through result strings with For Each
Dim part AsStringForEach part In parts
Console.WriteLine(part)
NextEndSubEndModule
Output
C:
Users
Sam
Documents
Perls
Main