Ver Mensaje Individual
  #13  
Antiguo 05-10-2006
Avatar de Wonni
Wonni Wonni is offline
Miembro
 
Registrado: abr 2006
Posts: 261
Reputación: 19
Wonni Va por buen camino
Holas, esta aqui ixMike conmigo y dice que aqui teneis el codigo:

Código Delphi [-]
Function ContarPalabras(Texto: String; Separador: Char): Integer;
var i: Integer;
begin
Result:=0;
If Length(Texto)=0 then Exit else
 for i:=1 to Length(Texto) do if Texto[i]=Separador then Inc(Result);
Inc(Result);
end;
 
Function ObtienePalabra(Texto: String; Separador: Char; Indice: Integer): String;
var
  c, n, p: Integer;
  Resto: String;
begin
If Pos(Separador,Texto)=0 then Result:=Texto else
  begin
  c:=1;
  for n:=1 to Length(Texto)do
   if Texto[n]=Separador then
     begin
     if Indice=1 then
       begin
       Result:=Copy(Texto,1,n-1);
       Exit;
       end;
     Inc(c);
     p:=n+1;
     Resto:=Copy(Texto,p,Length(Texto)-p+1);
     If c=Indice then
       begin
       If Pos(Separador,Resto)>0 then
        Result:=Copy(Texto,p,Pos(Separador,Resto)-1)else Result:=Resto;
       Exit;
       end;
     end;
  end;
end;

y dice: "que aproveche !!"

Saludos !!
Responder Con Cita