[Solved] Drawing a string with line break (or any \) created from "outside"

Discussion in 'Programming' started by Dawn, Aug 24, 2018.

  1. Dawn

    Dawn Member

    Joined:
    Sep 5, 2016
    Posts:
    58
    It seems \ does not work for a string variable set by included files.

    For example,

    This works.

    This works too.

    This shows the text literally with no line break but \n.

    I think it happened in 1.4 too but I'm not sure it's a bug or I missed something.
     
  2. Dawn

    Dawn Member

    Joined:
    Sep 5, 2016
    Posts:
    58
    Nevermind. Solved it by using
    string_replace_all(txt,"\\n","\n");
     
  3. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,469
    \ escape sequences are only for strings inside the code.
    If you want escape sequences inside externally loaded strings, you'd handle them yourself (just as you have already figured out)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice