PHP Code:
function onCreated()
{
this.string = new TStaticVar();
this.string.n.one = 1;
this.string.n.two = 2;
temp.arr = this.string.savevarstoarray(0);
for ( a: temp.arr )
if ( contains( a, b ) )
echo( a );
}
When b = "two": n.two=2
When b = "n": n.two=2,n.one=1
When b = "one": n.one=1
When b = "t": ... Nothing.
When b = "o": ... Nothing.
When b = "n.": ... Nothing.
When b = "=": ... Nothing.
When b = "1": n.one=1
Summary:
When using the 'contains' function, the results vary. By deduction, we can see that if a string contains "two", than it must contain "t", however... It returns false.
It seems like the string is split by symbols ( ., =, " ", etc etc ) and then they are compared token[x] == needle.
Working Version:
PHP Code:
function contains( haystack, needle )
{
if ( haystack.type() == 2 )
return false;
for ( i = 0; i =< haystack.length() - needle.length(); i ++ )
{
if ( haystack.substring( i, needle.length() ) == needle )
return true;
}
return false;
}