Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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.
0 Kudos
1 REPLY 1
RokuKC
Roku Employee
Roku Employee

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.

0 Kudos
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!