How do I Find a number within another number?

From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • so, I want to look at a bunch of text boxes and decide if they contain the same number as a single digit variable.

    So, if the number I want is five, it should find text boxes with 5, 15,25, 45, 54 etc.

    Does variable Y contain variable X?

    I hope that makes sense!

    Thanks

    Tagged:

  • Repeat tokencount(Y,",")

    Then sub-event: find(tokenat(Y, loopindex, ","), X) not equal -1

    > do action add tokenat(Y, loopindex, ",") into result text

    Ex: Set result = result & tokenat(Y, loopindex, ",")

  • Thanks Maverick, but I'm not sure how to get that in?!

    I assume it's using the JSON object?

    I can create a JSON string, and I can Parse it- is that along the right lines?

    Sorry for my ignorance! I'm coming back to Construct after a long absence!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, it is not using JSON, just simple condition like this:

    My TextInput_Within.Text is your string: 5, 15,25, 45, 54 etc.

    I separate number by "," to find X inside each of them.

    If it find X inside any number, it will join that number into another string named stringFound.

    The count is only for me to check if there is X inside, so if count=0 no X was found.

    Hope it is clear to you :D

    Don't hesitate to contact me on Skype: DongNguyen602

  • Mate, that is super helpful!

    Thanks a million- I'll get that in my project right now...

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