lucasdeveloper
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2022
02:13 PM
Split a string with 140K lines
Hello Roku Team,
I have a response HTTP that returns a txt file with 1.3MB and 140k lines.
I would like split the string in an array. I'm using the follow regex:
text = searchRequest.getToString() reLineSplit = CreateObject ("roRegex", "(?>\r\n|[\r\n])", "") for each line in reLineSplit.Split (text) end for
But, it's taking time to run.
Do you have a suggestion for me?
Thanks in advance.
1 REPLY 1


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2022
04:25 PM
Re: Split a string with 140K lines
That seems like an excessive amount of data to be working with.
Can you pass some filters to your web request to get just the data actually needed for the displayed content or business logic?
Or use a windowed query to just download small portions of the data at a time?
Aside from that, if you do just:
for each line in text.Split(Chr(13) + Chr(10))
' do something with line
end for
I would expect that to be orders of magnitude faster than using roRegex.
YMMV.