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

Inputting special characters like newline into strings

When you want to display strings with newlines (or any other special char), you need to use the chr() funtion. This function takes an integer as input and outputs the ascii character corresponding to that integer. Since the ascii value of '\n' is 10, you can display separate lines on a paragraph screen like so:

txt = "List of Special Instructions"+chr(10)
txt = txt + "1. Goto our great site..."+chr(10)
txt = txt + "2. Create an account..."+chr(10)
txt = txt + "3. Link your Roku..."+chr(10)

dialog.SetText(txt)
0 Kudos
3 REPLIES 3
renojim
Community Streaming Expert

Re: Inputting special characters like newline into strings

It doesn't appear that tabs are supported? At least on the Paragraph Screen.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
RokuKevin
Visitor

Re: Inputting special characters like newline into strings

On roParagraphScreen, the tab is honored but the tab stops make it appear like just a space.... here's how to make tabs work with roParagraphScreen

txt = "List of Special Instructions"+chr(10)
txt = txt +chr(9)+chr(9)+"1. Goto our great site..."+chr(10)
txt = txt +chr(9)+chr(9)+"2. Create an account..."+chr(10)
txt = txt +chr(9)+chr(9)+"3. Link your Roku..."+chr(10)

screen.AddParagraph(txt)
0 Kudos
renojim
Community Streaming Expert

Re: Inputting special characters like newline into strings

Thanks, but I was looking for something more like this:


Pitcher: Jim Palmer
Catcher: Elrod Hendricks
1st Base: Boog Powell
3rd Base: Brooks Robinson

Because of the proportional font used on that screen, there's no way to line up the second part perfectly.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.