StrPos

From Soldat Community Wiki
Jump to: navigation, search

From the Scripting Manual

function StrPos(const Substr, S: string): integer;

Parameter Info:
 Substr (String): Substring to search for.
 S (String): String to search in.

Description:
 This function will return the integer position of the first occurence of (Substr) in (S).
 Note that the use of StrPos has the same result as the function Pos, except that it is slower. We Advise the use of Pos over StrPos.

Examples

var
MyString: string;
begin
    MyString := 'foobar';
    StrPos('bar',MyString); //4
    StrPos('f',MyString); //1
    StrPos('o',MyString); //2
end;


External Links