Ver Mensaje Individual
  #5  
Antiguo 30-03-2012
ingmichel ingmichel is offline
Miembro
 
Registrado: jun 2007
Posts: 137
Reputación: 17
ingmichel Va por buen camino
Muchas Gracias

muchisimas gracias, he probado tu funcion y funciona muy bien, que dios te bendiga mi hermano y que viva delphi!!!

Cita:
Empezado por iFoo Ver Mensaje
Prueba con esto.

function ParseSQL(textoE: String; delimitador: String): String;
var
fila: Integer;
index: Integer;
delta: Integer;
cadena: String;
textoS: String;
textoTMP: String;
begin
Result := EmptyStr;

fila := 0;
delta := Length(delimitador);
textoS := textoE + delimitador;

try
while Length(textoS) > 0 do
begin
index := Pos(delimitador, textoS);
cadena := Copy(textoS, 0, index - 1);
textoS := Copy(textoS, index + delta, MaxInt);

if (fila > 0) then
textoTMP := textoTMP + cadena + chr(13);

Inc(fila);
end;
finally
Result := textoTMP;
end;
end;

Para utlizar esta función, te doy un ejemplo, dentro de un boton colocas esto:

procedure TForm1.Button1Click(Sender: TObject);
var
textoE: String;
textoS: String;
begin
textoE:= 'CORONA TAVAREZ, RAQUEL EUNICE PEREZ AGUILERA, ANA ERCILIA QUEVEDO RAMIREZ, ESTEBAN';
textoS := ParseSQL(textoE, ',');

ShowMessage(textoS);
end;
Responder Con Cita