I'm not sure I understood all that so this is probably not right. I simply went by the rule that: IF the first word of the current sentence is totally in capital letters, then that entire sentence would be wanted for the final collection. So from the list you posted at the end, this would be in a collection you could output:
DOBERMAN A BIG handsome
ENGLISH Bulldog pups for sale
ENGLISH Bulldog pups, vet 4,
Place a listbox on the form and place this code in a button click event or something.
2 Code:
Dim finalWords As New List(Of String) Using SR As New IO.StreamReader("star.txt") Dim tempStr As String = Nothing Dim temp() As String Dim isUpp As Boolean Do While SR.Peek <> -1 tempStr = SR.ReadLine.Trim temp = Nothing temp = tempStr.Split(" "c) isUpp = True For Each ch As Char In temp(0).Trim If Not Char.IsUpper(ch) Then isUpp = False End If Next If isUpp = True Then finalWords.Add(tempStr) End If Loop End Using Me.ListBox1.Items.AddRange(finalWords.ToArray)




Reply With Quote