I'm working on a project where I need to iterate through all the words in a string, but I also need to keep whitespace as that is important to what I need. For example, currently this is happening:
What I need is for the results to look like this:
What should I do?!
Code:
Dim line As String = "the quick brown fox jumps over the lazy dog"
For y As Integer = 0 To line.Split({" "}, StringSplitOptions.None).Count - 1
Console.WriteLine(line.Split({" "}, StringSplitOptions.None)(y))
Next
'Result
'-------
'the
'quick
'brown
'fox
'jumps
'over
'the
'lazy
'dogCode:
'Result
'-------
'the
'
'quick
'
'brown
'
'fox
'
'jumps
'
'over
'
'the
'
'lazy
'
'dog





