Registriert seit: 24. Dez 2002
Ort: Hamburg-Harburg
3.551 Beiträge
|
Re: string problem
27. Nov 2005, 15:51
Delphi-Quellcode:
function GetTok(const Str: string; const Idx: Integer; const Sep: Char): string;
var
StrLen: Integer;
StrIdx: Integer;
ResLen: Integer;
TokIdx: Integer;
begin
Result := '';
if Idx > 0 then
begin
StrLen := Length(Str);
SetLength(Result, StrLen);
ResLen := 0;
TokIdx := 0;
for StrIdx := 1 to StrLen do
begin
if (Str[StrIdx] <> Sep) and ((StrIdx = 1) or (Str[StrIdx-1] = Sep)) then
Inc(TokIdx);
if TokIdx > Idx then
Break
else if (TokIdx = Idx) and (Str[StrIdx] <> Sep) then
begin
Inc(ResLen);
Result[ResLen] := Str[StrIdx];
end;
end;
SetLength(Result, ResLen);
end;
end;
Delphi-Quellcode:
hG := Trim(GetTok(strgtest.Cells[0,4], 1, '-'));
G := Trim(GetTok(GetTok(strgtest.Cells[0,4], 2, ':'), 1, ','));
w := Trim(GetTok(GetTok(strgtest.Cells[0,4], 2, ':'), 2, ','));
so dürfte es gehen (ungetestet)
Mario MSN: cyanide@ccode.de
|
|
Zitat
|