How do I spell string into array ?

Get help using Construct 2

Post » Thu Sep 07, 2017 4:12 pm

hello everyone,
i'm trying to make something for fun, but to accomplish this i need to remove parts of strings recorded into variables.

so the best way i think, is to get this string, wich can be anything, spelled letter by letter into an array wich can be manipullated easilly after.

so how can i have a "foreach letter" from string function ?
B
16
S
3
Posts: 106
Reputation: 1,408

Post » Thu Sep 07, 2017 4:34 pm

Code: Select all
For "x" from 0 to Len(myString)   
  myArray  Set value at loopindex to Mid(myString, loopindex, 1)


You can also import the entire array from JSON-formatted string, like this:
Code: Select all
myArray Load from JSON string "{""c2array"":true,""size"":[2,1,1],""data"":[[[123]], [[456]]]}"
Check out my awesome game Doptrix
B
17
S
9
G
30
Posts: 525
Reputation: 17,349

Post » Thu Sep 07, 2017 4:50 pm

thanks for your quick answer,
i fund another to do it without array, by using left and right parameters that I didn't know.
B
16
S
3
Posts: 106
Reputation: 1,408


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, jatin1726, Kyatric and 29 guests