Forum Discussion

signal12's avatar
signal12
Visitor
7 years ago

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

2 Replies

  • 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