(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
From the Scripting Manual
function GetPiece(source, delimiter: string; const piece: integer): string;
Parameter Info:
Source (String): String to be split.
Delimiter (String): String to be used as a splitting point.
Piece (Integer): Index to return from the split array.
Description:
This functions uses the regular split function, but returns the specified Index so you do not need to use a seperate variable for the Split array.
Examples
var
MyString: string;
begin
MyString := 'Hello World, I am here to stay!';
WriteLn(GetPiece(MyString,' ',0)); //Hello
WriteLn(GetPiece(MyString,' ',1)); //World,
WriteLn(GetPiece(MyString,' ',5)); //to
end;
External Links