GetStringIndex

From Soldat Community Wiki
Jump to: navigation, search

From the Scripting Manual

function GetStringIndex(needle: string; haystack: array of string): integer

Parameter Info:
 needle (String): String to search for.
 haystack (Array of String): Array of strings to search in.

Description:
 This function will return the array index of (needle) if found in array (haystack).

Examples

var
MyArray: TStringArray;
begin
    MyArray[0] := 'foo';
    MyArray[1] := 'bar';
    MyArray[2] := 'clan';
    MyArray[3] := 'rox';
    GetStringIndex('bar',MyArray); // 1
    GetStringIndex('rox',MyArray); // 3
end;


External Links