Difference between revisions of "ExplodeEx"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function ExplodeEx(Separator, s: AnsiString; Limit: Integer): TStringArray; </source> ==Availability== SCAR Divi 3.20 > Current...")
 
 
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
function ExplodeEx(Separator, s: AnsiString; Limit: Integer): TStringArray;
+
function ExplodeEx(const Separator, Str: string; const Limit: Integer): TStrArray;
 
</source>
 
</source>
  
Line 8: Line 8:
  
 
==Description==
 
==Description==
Splits a given [[AnsiString|string]] '''s''' into a [[TStringArray]] 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 '''s''' is empty, the function will return an empty array.
+
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==
 
==Example==
 
<source lang="scar">
 
<source lang="scar">
 
var
 
var
   SA: TStringArray;
+
   SA: TStrArray;
  
 
begin
 
begin

Latest revision as of 19:27, 18 October 2012

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