Page 1 of 1

Search Array

PostPosted: Thu Nov 19, 2015 2:15 pm
by TinTin
Hi all,

Can't seem to get this - adding to an array which is within a list box need to check if item is already in array

Example below..

Only works if I'm searching with a real string value (Pre defined) not a variable which can change at runtime..

Any help would be appreciated.

Cheers


SetVar [StringA] "One,Two,Three,Four"

StrParse "[StringA]" "," [Parsed]
SetVar [Combined] [Parsed(0)]+" - "+[Parsed(1)]
ArrayAddItem [Items] [Combined]


.// Search Array
ArraySearch [Items] "[Combined]" [Found]

Re: Search Array

PostPosted: Fri Nov 20, 2015 6:24 pm
by Neosoft Support
Your code works, but you have to create the array before you can add items to it. For example:

.create empty array
CreateArray [Items] ""


SetVar [StringA] "One,Two,Three,Four"

StrParse "[StringA]" "," [Parsed]
SetVar [Combined] [Parsed(0)]+" - "+[Parsed(1)]
ArrayAddItem [Items] [Combined]

.// Search Array
ArraySearch [Items] "[Combined]" [Found