- function Explode(ch : string;sep: string = ';'):TStringList;
- var
- p : integer;
- begin
- p := pos(sep,ch);
- explode := TStringList.Create;
- while p > 0 do begin
- explode.Add(copy(ch,1,p-1));
- if p <= length(ch) then ch := copy(ch,p+ length(sep),length(ch));
- p := pos(sep,ch);
- end;
- explode.Add(ch);
- end;
-
- function Implode(lst:TStringList;sep : string =';'):string;
- var
- i : integer;
- s : string;
- begin
- i:= 0;
- while i < lst.Count - 1 do begin
- s := s + lst[i] + sep;
- i := i + 1;
- end;
- if i < lst.Count then s := s + lst[i]; //Ne mets pas de séparateur sur le dernier élément
- result := s;
- end;
function Explode(ch : string;sep: string = ';'):TStringList;
var
p : integer;
begin
p := pos(sep,ch);
explode := TStringList.Create;
while p > 0 do begin
explode.Add(copy(ch,1,p-1));
if p <= length(ch) then ch := copy(ch,p+ length(sep),length(ch));
p := pos(sep,ch);
end;
explode.Add(ch);
end;
function Implode(lst:TStringList;sep : string =';'):string;
var
i : integer;
s : string;
begin
i:= 0;
while i < lst.Count - 1 do begin
s := s + lst[i] + sep;
i := i + 1;
end;
if i < lst.Count then s := s + lst[i]; //Ne mets pas de séparateur sur le dernier élément
result := s;
end;