ScriptCore3.SplitRegExpr

From Soldat Community Wiki
Revision as of 14:21, 25 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
procedure SplitRegExpr (const ARegExpr, AInputStr: string; APieces : TStrings);
 ARegExpr: regular expression
 AInputStr: string to be split
 APieces: result of split as TStrings 

Description

Split AInputStr into APieces by r.e. ARegExpr occurencies

For detailed information about Regular Expressions see Regular_Expression on Wikipedia

Example

const
  Reg = 'line';
  Str = '0line1line2line3line4';

var
  Res: TStringList;

begin
  Res := File.CreateStringList;
  
  SplitRegExpr(Reg,Str,Res);
  
  WriteLn(Res.Text);
  {
  0
  1
  2
  3
  4
  
  }
  
  Res.Free;
end.