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: 
signal12
Visitor

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?

Thanks
0 Kudos
2 REPLIES 2
speechles
Roku Guru

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
signal12
Visitor

Re: strchr() equivalent in Brightscript

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