function cortar(xStr : String; dl , dl2: String) : TStrings;
var
a, b : Integer;
Splited : String;
begin
Result := Nil;
Result := TStringList.Create;
a := AnsiPos(dl, xStr);
while a <> 0 do
begin
a := AnsiPos(dl, xStr);
b := AnsiPos(dl2, xStr);
splited := Copy(xStr, a + Length(dl), b - a - Length(dl));
if Length(splited) <> 0 then
begin
Result.Add (splited);
xStr := Copy(xStr, b + Length(dl2), Length(xStr));
end;
end;
end;
Funciona con strings que sigan un patron como por ejemplo:'##ola k ase%% bla bla bla ##foo fighters%%'
Al cortar con delimitadores '##' y '%%' nos devuelve: 'ola k ase' y 'foo fighters'.
Salu2!