Reputation: 25
So i have keywords on my text box that have 2 spaces or more
Example:
spotify premium apk
spotify login
spotify family
spotify mod apk
spotify apk
spotify app
spotify account
spotify apk mod
spotify app download
spotify apk download
spotify app for pc
what code should i use to remove all lines that have 2 spaces or more, i want to make my example into this.
spotify login
spotify family
spotify apk
spotify app
it will remove all lines that have 2 spaces or more
Upvotes: 0
Views: 35
Reputation: 74605
Any of these will find the lines for you (my order of preference):
Dim r = textBox.Lines.Where(Function(line) line.IndexOf(" "c) < line.LastIndexOf(" "c)).ToArray()
Dim r = textBox.Lines.Where(Function(line) line.Length - line.Replace(" ", "").Length > 1).ToArray()
Dim r = textBox.Lines.Where(Function(line) line.Split().Length > 2).ToArray()
I'll leave it as an exercise for the reader as to get the lines back into the textbox
ps; you'll need to import System.Linq
Upvotes: 1