Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 7

strchr() equivalent in Brightscript

I have a text file that my main.brs reads in.  The file has a good number of lines, and each data line looks like this:

12.24, -63.0, 1234, -0.55;

Each value separated by a comma, end of line delineated by a semicolon.

How do I extract the individual values from the string?  In C, I would use strchr() to find the location of the commas, is there an equivalent in Brightscript?  If not, how can this be done?

0 Kudos
Level 10

Re: strchr() equivalent in Brightscript

text = "12.24, -63.0, 1234, -0.55;"
text = left(text,text.len()-1) ' get rid of the ; at the end
values = text.tokenize(", ")
for each value in values
    print val(value)
next value
0 Kudos
Level 7

Re: strchr() equivalent in Brightscript

Thank you so much that is exactly what I was looking for.
0 Kudos