text manipulation

  • im having a hard time figuring this out, because i never used this string functions before...

    i want to loop thru this string and get every value in an array

    4|5654|8948|44|

    this i found out

    tokencount(varload,"|") - 1 = number of seperators

    find(varload, "|") = first part of the string before "|"

    but now how do i get to the next value of the seperator?

    ive seen some examples but i dont understand, can anybody explain how and how its works?

    if i know how to loop thru all these i should also be able to put then in an array i guess

  • vtrix, is this what you're looking for?

    dl.dropbox.com/u/38038537/StringToArray_example.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • find(varload, "|") = position of the first | in the string

    basically you get each token ( = part between separators) by incrementing an iterator

    the iterator can be a simple variable or a loopindex

    global iterator = 0
    every 5.0 seconds :
        set text to tokenat(varload,iterator,"|")
        add 1 to iterator[/code:32ezzhr4]
    
    or
    
    [code:32ezzhr4]for "itLoop" from 0 to tokencount(varload,"|")-1
        append to text : tokenat(varload,loopindex("itLoop"),"|")[/code:32ezzhr4]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)