How do I recognize "newline" for "tokenat"?

0 favourites
  • 4 posts
  • Hi. Since the XML Plugin does not seem to work right now (says XPath needs to be string instead of number, but I entered a string) I tried to use a comma separated list with values like:

    a1, b1, c1

    a2, b2, c2

    I loaded the textfile with AJAX and tried the tokenat and tokencount system actions. I tried to use "newline" and "&newline" as separator and it returns a number for tokencount (1) but it does not seem to work. I make a For loop from 0 to tokencount and saved the result in a local variable. Then I used tokenat with "," as separator for the stored string to get the data for this entry (each line is one entry) but it returns both lines with the linebreak after c1. Any ideas how this might work?

    Example code:

    Returned:

    [quote:3lfdhmi0]Stored Data: a1,b1,c1

    a2,b2,c3

    Stored Data:

  • Ah! I think I got it!

    I used the string "newline" and not just newline as separator (was used to this from using "," and other chars). It returns 2 now and if I add -1 to the tokencountloop it seems to work fine. Or any other ideas to improve/change it?

    the loop:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I never knew that we could use newlione as a token.

    Very neat find

  • Hey man, I'm just trying to do the same with a text file, but i'm not really good at using tokenats and parsing text... Could you please upload an example of how to do this?

    PD. your pictures are deleted.

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