String Escaped Characters??

  • So escaped characters don't seem to work in strings such as \n, there is a system expression for newline which can be used to have the same effect, but what if you wanted to do something like \t to add tabs between string? \t does not work inside the string, and there is no tab expression that produces the same effect? is there another way to accomplish this.

    note adding " " does not work, the tabs take the previous set of text into account and lines every thing up properly. i also tried to copy a tab character and paste it but it reduces it to a single space?

  • Try this:

    Set text to "The quick brown fox" & Browser.ExecJS("String.fromCharCode(9);") & "jumps over the lazy dog."

    9 is the ASCII code for Tab character.

  • okay that works, but it is overly verbose. in the meantime this is good enough. thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well, to make thing easier you can use tags in your text, like "apple /t banana /n". Create a function that will replace these tags with proper characters and call it before printing.

  • You could also convert the whole string:

    -> System: Set myString to """This is a \t tab"""

    -> Text: Set text to Browser.ExecJS("String("&myString&")")

    or direct:

    -> Text: Set text to Browser.ExecJS("String(""This is a \t tab"")")

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)