Sub EditText1_TextChanged (Old As String, New As String)
Dim i As Int = IndexOfNth(New, CRLF, 3)
If i > -1 Then
EditText1.Text = New.SubString2(0, i)
EditText1.SelectionStart = EditText1.Text.Length
End If
End Sub
Sub IndexOfNth(s As String, SearchFor As String, Count As Int) As Int
Dim res As Int = -1
For i = 0 To Count - 1
res = s.IndexOf2(SearchFor, res + 1)
If res = -1 Then Return -1
Next
Return res
End Sub