GetStringIndex

From Soldat Community Wiki
Revision as of 10:26, 15 August 2012 by Freeman (talk | contribs) (Created page with "===From the Scripting Manual=== ''function GetStringIndex(needle: string; haystack: array of string): integer'' '''Parameter Info:''' needle (String): String to search f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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