Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-03

Easy string-splitting

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

S. Fisher
uses regexpr, classes;
var
  pieces : tstringlist;
  s : string;
begin
  pieces := TStringList.create;
  SplitRegExpr( '--+| *, *',
                'thus--and even , hurly-burly,willy-nilly',
                pieces );
  for s in pieces do  writeln( s, '<');
  pieces.destroy;
end.

Output:

thus<
and even<
hurly-burly<
willy-nilly<

Reply by email