lock_4815162342
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-19-2014
08:49 AM
How do I split a string into multiple stings?
I have a parsed string that I want to put into a paragraph screen. I want the string to have lines separated by newlines. I tried using \n but it is reading it as literal text.
Can I go through a string and check each character and split the lines based on a delimiter ?
Can I index a string to do so?
Thank you for your help. š
Can I go through a string and check each character and split the lines based on a delimiter ?
Can I index a string to do so?
Thank you for your help. š
2 REPLIES 2

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-19-2014
09:58 AM
Re: How do I split a string into multiple stings?
You can use roRegex.Split to split a string on a delimiter.
You may also want to look at this code that splits a string based on length, but it's intended for, and may only work correctly with, roScreen.
--Mark
You may also want to look at this code that splits a string based on length, but it's intended for, and may only work correctly with, roScreen.
--Mark
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-19-2014
11:36 AM
Re: How do I split a string into multiple stings?
Another way to split the string is to use roString.Tokenize(), like so:
BrightScript Debugger> nl = chr(10)
BrightScript Debugger> s = "1" + nl + nl + "2" + nl + "3"
BrightScript Debugger> ? s.tokenize(nl)
1
2
3