How do I search for a string in multiple columns of an array

0 favourites
  • 2 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello all,

    Say I have imported an array from CSV, with the first colum being names of the countries, and the first row being different score values of those countries.

    [

    ["NAME"],["CAPITAL"],["SCORE_ECONOMY"],["SCORE_MILITARY"] ] [

    ["USA"],["WASHINGTON"],[150],[22] ] [

    ["CHINA"],["BEIJNG"],[122],[12] ]

    Is there a way I set all score to 0 (military & economy) for both countries (USA & china) in one single action ?

    In order to to this I would like to find a way to search each 0,Y (or "for each Y element") positions and check if they contain the string "SCORE".

    I already know I can find my country in the first column with "for each X element".

    I am not sure whether it would help if I joined my capx ; i guess i would have to simplify it first.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • system > for (for "x" from 2 to 3) and (for "y" from 0 to 1) --> array > set value at XY (x = loopindex("x"); y = loopindex("y"); value = 0)

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