StrPos

From Soldat Community Wiki
Revision as of 11:17, 15 August 2012 by Freeman (talk | contribs) (Created page with "===From the Scripting Manual=== ''function StrPos(const Substr, S: string): integer;'' '''Parameter Info:''' Substr (String): Substring to search for. S (String): Stri...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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