我有一个循环,它逐行从文本框中提取字符串我想要一个条件,如果它的最后一行我将它存储在另一个文本框中。这是我的代码
Dim builder As New StringBuilder()
Dim reader As New StringReader(txtOCR.Text)
While True
Dim line As String = reader.ReadLine()
If line Is Nothing Then Exit While
Dim WordCount = New Regex("\w+").Matches(line).Count
If WordCount = 1 And Not line.ToLower().Contains("by") Then
builder.AppendLine(line)
ElseIf line.ToLower().Contains("the") And Not line.ToLower().Contains("by") Then
builder.AppendLine(line)
ElseIf line.ToLower().Contains("an") And Not line.ToLower().Contains("by") Then
builder.AppendLine(line)
End If
End While
txtTitle.Text = builder.ToString()