🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    "\n" becomes "\\n"

    UIFlow
    3
    5
    7.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Peter
      last edited by

      I want to output multiline text. If I enter the text as a literal in the properties of a label, the line break is executed correctly. But if the text with the line break is in a variable \n becomes \\n. This means that the line break is no longer executed. Is this behavior intentional?
      I think it is a bug that should be corrected as soon as possible.

      Thanks a lot

      world101W 1 Reply Last reply Reply Quote 0
      • world101W
        world101 @Peter
        last edited by

        @peter

        I guess it seems like a bug, but I'm not sure who's bug it is. The official Google Blockly does the same thing...

        0_1616508182017_Screen Shot 2021-03-22 at 7.44.10 PM.png

        P 1 Reply Last reply Reply Quote 0
        • P
          Peter @world101
          last edited by Peter

          @world101
          Then M5Stack must have taken over the problem.
          I will try again with replacing "\\n" with "\n" with the appropriate text block. But still got to it because my computer had to be reinstalled. I will report back.

          R 1 Reply Last reply Reply Quote 0
          • R
            robalstona @Peter
            last edited by

            the problem is probably that the parser of the uiflow editor treats the \ character as a special character and prefixes it with another character in order to display it. The effect of this is that only one character should be displayed. The problem is that after this character is encountered, the rest of the character is not taken into account. You can work around this problem by using the Execute code: block and enter the code directly

            myVar = 'text\n'
            
            P 1 Reply Last reply Reply Quote 0
            • P
              Peter @robalstona
              last edited by

              @robalstona

              Tnx for the tipp. I'll try it.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post