function StrTok(Phrase: Pchar; Delimeter: PChar): Pchar;
const
tokenPtr: PChar = nil;
workPtr: PChar = nil;
var
delimPtr: Pchar;
begin
if (Phrase <> nil) then workPtr := Phrase else workPtr := tokenPtr; if workPtr = nil then begin Result := nil; Exit; end; delimPtr := StrPos(workPtr, Delimeter); if (delimPtr <> nil) then begin delimPtr^ := Chr(0); tokenPtr := delimPtr + 1 end else tokenPtr := nil; Result := workPtr; end; |