Registriert seit: 5. Nov 2004
Ort: Coesfeld
1.268 Beiträge
Delphi 2010 Professional
|
Explode Unicode Änderung
22. Dez 2009, 22:32
Hallo,
ich nutze bisher folgende Explode-Funktion aus dem Forum:
Delphi-Quellcode:
function Explode(const Separator, S: string; Limit: Integer = 0): TStringDynArray;
var
SepLen: Integer;
F, P: PChar;
ALen, Index: Integer;
begin
SetLength(Result, 0);
if (S = '') or (Limit < 0) then Exit;
if Separator = '' then
begin
SetLength(Result, 1);
Result[0] := S;
Exit;
end;
SepLen := Length(Separator);
ALen := Limit;
SetLength(Result, ALen);
Index := 0;
P := PChar(S);
while P^ <> #0 do
begin
F := P;
P := AnsiStrPos(P, PChar(Separator));
if (P = nil) or ((Limit > 0) and (Index = Limit - 1)) then P := StrEnd(F);
if Index >= ALen then
begin
Inc(ALen, 5);
SetLength(Result, ALen);
end;
SetString(Result[Index], F, P - F);
Inc(Index);
if P^ <> #0 then Inc(P, SepLen);
end;
if Index < ALen then SetLength(Result, Index);
end;
Wie muss ich die anpassen, damit ich Sie unter D2010 nutzen kann?
Viele Grüße ....
|
|
Zitat
|