ExplodeEx

From SCAR Divi Manual
Jump to: navigation, search

Definition

function ExplodeEx(const Separator, Str: string; const Limit: Integer): TStrArray;

Availability

SCAR Divi 3.20 > Current

Description

Splits a given string Str into a TStrArray by breaking of at every substring given by Separator. If the value given by Limit is larger than 0, the function will return an array with that given size, with the last entry containing the part of the string that wasn't split and the other entries the first "Limit - 1"-entries that were split. When Limit is smaller than 0 or Str is empty, the function will return an empty array.

Example

var
  SA: TStrArray;

begin
  SA := ExplodeEx(' ', 'a b c d e f g h i j k l m n o p q r s t u v w x y z', 10);
  WriteLn(SA[9]);
end.

Output:

j k l m n o p q r s t u v w x y z

See Also