Iterate or loop through lines in EditText

b4AMarkO

Member
Licensed User
Longtime User
Can this be done in B4A?
If so How do you do it?

I seem to recall that in a RTB in vb you could do it something like this

B4X:
For Each line in RTB1.Lines
   If line.Contains("Apple" Then
      ' Do what you need to do here
   End If
Next

So can I do something like this to an EditText?
 

stevel05

Expert
Licensed User
Longtime User
Not directly but you can split the text to an array using Regex and the iterate over the array:

B4X:
Dim TextArray() As String
TextArray = Regex.Split(CRLF,EditText1.Text)

For Each Line As String In TextArray
   Log(Line)
Next
 
Upvote 0

b4AMarkO

Member
Licensed User
Longtime User
Not directly but you can split the text to an array using Regex and the iterate over the array:

B4X:
Dim TextArray() As String
TextArray = Regex.Split(CRLF,EditText1.Text)

For Each Line As String In TextArray
   Log(Line)
Next

Yes that will getter done .. Thank you very much
 
Upvote 0
Top