How do I make a string divider

0 favourites
  • 4 posts
  • I understand that question maybe very-very easy but I can't formulate my search query correctly.

    I'm not a newbie in construct but I never need to solve this kind of problem earlier.

    The question Is about how to divide string into parts with newline divider. But without it.

    Example: This is a string in some .json file - "Hello, Commander! Let's do businness blah-blah-blah. Good Luck, Commander!"

    I want to read it and apply to Text object, but to make phrase "Good Luck, Commander!" on a newline.

    No problems with reading. How to make a newline? Is there a way to replace text with some special symbols (for example, in Pascal it was #13+#10) to make it happen?

    IMPORTANT! Arranging and reading 2 different strings and divide it with newline expression IS NOT A VARIANT!!! String is solid. We need to tear it apart with something, that can replace newline.

    The other question is how to make this through edittime?

    In Construct Classic for Text object we can open small window with MemoBox and write all text we want, needed amount of strings etc.

    In C2 we have just 1 string TEXT.. and no ways to put newline string here. Or there are some ways? Can you help?

  • Have you tried using System Expression: tokenat?

    System Expression: tokenat

    How Do I Recognize "newline" for "tokenat"

  • See this manual page:

    Here you find the expression replace(src, find, rep)

    So in your case you should be able to do this ex. "Hello, Commander! Let's do businness blah-blah-blah. ###Good Luck, Commander!"

    replace(yourstring, "###", "" &newline &"")

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, I know tokenat expression.. and I just forget about it.

    Thank you! I think it will be better using it with tokencount at the same time!

    Question with edittime is opened.

    No ways to edit Text object row-by-row? Only using Set text action?

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