Invisionsoft
Well-known member
Hi folks,
I am ashamed to say this but I am using a textbox to split up a string:
I have a text file which looks like:
%James
%Bob
%John
I want any lines beginning with % to be shoved into a collection so I can work with it later. I have tried the following:
But it's an epic fail.
I want to do it properly without a textbox, what's the right way?
I am ashamed to say this but I am using a textbox to split up a string:
VB.NET:
Dim rtb As New TextBox
rtb.Text = System.IO.File.ReadAllText("C:\blah.txt")
For Each XDSLine As String In rtb.Lines
If XDSLine.StartsWith("%") Then
FinalXDSLines.Add(XDSLine.Substring(1))
End If
Next
I have a text file which looks like:
%James
%Bob
%John
I want any lines beginning with % to be shoved into a collection so I can work with it later. I have tried the following:
VB.NET:
For Each XDSLine As String In System.IO.File.ReadAllText("C:\blah.txt").Split(Environment.NewLine)
If XDSLine.StartsWith("%") Then
FinalXDSLines.Add(XDSLine.Substring(1))
End If
Next
But it's an epic fail.
I want to do it properly without a textbox, what's the right way?