Hi have one like that it in my utils libs;


[pascal]
function GetTokenCount(Cadena,Separador:string):integer;
var
Posicion:integer;
begin
Posicion:=Pos(Separador,Cadena);
Result:=1;

if Posicion <> 0 then
while Posicion <0> 1 do begin
Delete(Cadena,1,Pos(Separador,Cadena));
Dec(Token);
end;
Posicion:=Pos(Separador,Cadena);
if Posicion=0
then result:=cadena
else Result:=Copy(Cadena,1,Posicion-Length(Separador));
end;

function GetToken(Cadena,Separador:string;Token:integer):st ring;
var
Posicion:integer;
begin
while Token > 1 do begin
Delete(Cadena,1,Pos(Separador,Cadena));
Dec(Token);
end;
Posicion:=Pos(Separador,Cadena);
if Posicion=0
then result:=cadena
else Result:=Copy(Cadena,1,Posicion-Length(Separador));
end;





[/pascal]







"cadena" mean the string where you want to search for tokens,
"separador" mean the string used as separator.

Note that separator can be any length.

example:

a:='za-bb-cx-dr-er-xz'

n:=gettokencount(a,'-'); //this will return integer value 6 which mean 6 token are available in the string.

s:=gettoken(a,'-',4); //will return string "dr", which is the 4th token in the string.



hope it helps