Forum Discussion

RokuKevin's avatar
RokuKevin
Visitor
16 years ago

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)

3 Replies

  • renojim's avatar
    renojim
    Community Streaming Expert
    It doesn't appear that tabs are supported? At least on the Paragraph Screen.

    -JT
  • 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)
  • renojim's avatar
    renojim
    Community Streaming Expert
    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