signal12
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019
08:12 PM
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
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 2

speechles
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019
08:16 PM
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
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
signal12
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019
08:23 PM
Re: strchr() equivalent in Brightscript
Thank you so much that is exactly what I was looking for.