Dim s As String = "1" & vbNewLine & "2"
Dim items() As String = s.Split(New String() {vbNewLine}, StringSplitOptions.None)
Dim s As String = "1" & Environment.NewLine & "2"
Dim items() As String = s.Split(Environment.NewLine)
Dim items() As String = s.Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
Dim items() As String = System.Text.RegularExpressions.Regex.Split(s, vbNewLine)
Actually not, that will leave a vbLF at the start of every item because it only splits at the first vbCR.
Below variant on the other hand will achieve the correct result at the expense of more processing. (it produces one empty item each linebreak, but remove empty entries)
There is also Regex that can split by String separators:VB.NET:Dim items() As String = s.Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
VB.NET:Dim items() As String = System.Text.RegularExpressions.Regex.Split(s, vbNewLine)
Dim RawData As String = txtScript.Text
Dim Lines() As String = RawData.Split(New String() {vbNewLine}, StringSplitOptions.None)
For i As Byte = 0 To Lines.Length - 1
Console.WriteLine(Lines(i) & " NEXT")
Next
ac=2
stacksize=1
weight=2
price=0,2,0,0
augmentlevels=7,0,0,0,0
slots=head
ac=2
stacksize=1
weight=2
price=0,2,0,0
augmentlevels=7,0,0,0,0
slots=head
NEXT
.Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
Yes, that is the easy part:Is there a way to remove empty lines
For Each line As String In tb.Lines
If line <> String.Empty Then
' you got a line that is not empty
End If
Next