How do I Compare array String with spaces

Get help using Construct 2

Post » Sat Mar 26, 2016 10:17 am

HI,

i'm actually doing a menu in wich you can set differents names for a team, and save it in an arraylist.

and there is an option to edit existing team.

the process i'm using is actually working for teams with simple names as rococo, fire, build etc...
but it doesn't works when i when to test composed names like: Buring Fire, Space angels etc...

is there a way i can confirm my test when it find Array.CurrentValue = Input.Text ?

Image
B
16
S
3
Posts: 104
Reputation: 1,404

Post » Sat Mar 26, 2016 12:14 pm

blackant wrote:HI,

i'm actually doing a menu in wich you can set differents names for a team, and save it in an arraylist.

and there is an option to edit existing team.

the process i'm using is actually working for teams with simple names as rococo, fire, build etc...
but it doesn't works when i when to test composed names like: Buring Fire, Space angels etc...

is there a way i can confirm my test when it find Array.CurrentValue = Input.Text ?



Are you sure that this works even without spaces?
Your variable NomExist will be overwritten with 1 even if you found the name in the Array, because the next element set the variable back to 1.Even if the last element is the name you are looking for, the variable will be set to 1 in the next tick, when the loop starts again. The variable will only a very short time 2.
Delete the first sub-event and it should work. You have to set the variable back to 1 after you have done what you want to do if you found a name, outside of the loop.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Sat Mar 26, 2016 12:32 pm

ok, i did wrong, it works only if the name is the last of the array during the test else it's overwrited.

thanks for your help
B
16
S
3
Posts: 104
Reputation: 1,404


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest