Cita:
|
Empezado por Crandel
El problema es que con Add, lo agrega en una sóla linea a todo el texto.
|
Se me ocurren varias formas de hacer esto, una es abusando de la función ExtractStrings:
Código Delphi
[-]
var
S: TStringList;
begin
S := TStringList.Create;
try
ExtractStrings([], [], '1'#13#10'2'#13#10'3'#13#10'4', S);
ShowMessageFmt('Líneas: %d'#13#10, [S.Count]);
finally
S.Free;
end;
Otra es armando una funcioncita para poder usar AddStrings
Código Delphi
[-]
procedure AddLines(AStrings: TStrings; const AText: string);
var
S: TStringList;
begin
S := TStringList.Create;
try
S.Text := AText;
AStrings.AddStrings(S);
finally
S.Free;
end;
end;
begin
AddLines(AStrings, '1'#13#10'2'#13#10'3'#13#10'4');
ShowMessageFmt('Líneas: %d'#13#10, [AStrings.Count]);
end;
Cita:
|
Empezado por Crandel
El memo lo reconoce perfectamente, pero no se porque el StringList no.
|
Seguramente utilizas la propiedad Lines que es un TString en lugar de Text
Saludos!