Reading Multiline Textbox Line by Line

ttronic

Member
Licensed User
Longtime User
Hello,
i must read the text , line by line from a multiline Textbox into a stringarray.
I have read the Guide for B4A and forum, but i can not find a solution.

Example:

Textbox (multiline)
---------------------------------
Line1
Line2
Line3
Line4
........
.....
---------------------------------

wish:
Stringarray(0) = "line1"
Stringarray(1) = "Line2"
....


in VB6 i have read it with a winos lowlevel function.

Thank you for Help
 

margret

Well-Known Member
Licensed User
Longtime User
This code should work for you:

B4X:
'Call like this
Dim myans() As String
myans = SplitText(EditText1.text)
'Results are in myans(0), myans(1), etc.

Sub SplitText(Text As String) As String()
   Dim sText() As String
   sText = Regex.Split(CRLF, Text)
   Return sText
End Sub
 
Upvote 0

ttronic

Member
Licensed User
Longtime User
Hi Margret,

that's the solution !

i have tried and found a other way, but your's is perfect. :)
b4a is great !

Thank you very much.
 
Upvote 0
Top