Espero que te sirva
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;
|