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

    "\n" becomes "\\n"

    Scheduled Pinned Locked Moved UIFlow
    5 Posts 3 Posters 9.3k Views 3 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              Peter @robalstona
              last edited by

              @robalstona

              Tnx for the tipp. I'll try it.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post