Escrever em uma StringList

Delphi

20/05/2011

Boa tarde a todos...
Utilizando uma stringlist preciso escrever na linha 5 coluna 10.Isto é possível?
Uelinton
Ureis

Ureis

Curtidas 0

Respostas

Wilson Junior

Wilson Junior

20/05/2011

O StringList começa em 0, logo, linha 1 = posição 0, linha 2 = posição 1, etc...

StringList[4] := StringList[4] + ' texto no final da linha 5';
StringList[9] := 'texto no início da linha 10 ' + StringList[9];

Espero ter colaborado.
GOSTEI 0
Fernandes

Fernandes

20/05/2011

procedure TForm1.ButtonEscreverClick(Sender: TObject);
Var
    slLista : TStringList;
    sStr1 : string;

begin

    //cria stringlist
    slLista := TStringList.Create;

    With slLista Do
     Begin

       Clear;
       Add( 'DELPHI' );       //linha 0
       Add( 'C#' );           //linha 1
       Add( 'ASP.NET' );      //linha 2
       Add( 'RAILS' );        //linha 3
       Add( 'DELPHI PRISM' ); //linha 4
       Add( 'PHP' );          //linha 5
       Add( 'JAVA' );         //linha 6

       //pela linha 4
       sStr1 := Strings[ 04 ];  //

       //troca posicao 10 pela letra Z
       sStr1[ 10 ] := 'Z';

       //atualiza linha 4
       Strings[ 04 ] := sStr1;

     end;

end;

GOSTEI 0
Ureis

Ureis

20/05/2011


O StringList começa em 0, logo, linha 1 = posição 0, linha 2 = posição 1, etc...

StringList[4] := StringList[4] + ' texto no final da linha 5';
StringList[9] := 'texto no início da linha 10 ' + StringList[9];

Espero ter colaborado.
 

Referente a linha nenhuma duvida,mas e referente a coluna?
Como faço para colocar determinada informação partir da 10º coluna?Exemplo gostaria de formatar informações como se fosse em tabelas que tem linhas e colunas.Ex.:Nome          Idade         SexoMaria          23               FJorge          30               M


Uelinton
GOSTEI 0
Wilson Junior

Wilson Junior

20/05/2011

Olha, acho que vc não está falando do componente TStringList, pois o mesmo não possui índice por colunas. Verfique qual o componente vc está utiilzando e post aqui no fórum.

Aguardo retorno.
GOSTEI 0
Ureis

Ureis

20/05/2011


Olha, acho que vc não está falando do componente TStringList, pois o mesmo não possui índice por colunas. Verfique qual o componente vc está utiilzando e post aqui no fórum.

Aguardo retorno.

 
 

Ok, pensei que poderia ter...
Tem algum componente que possa usar e que faça isto, e depois possa jogar em um memo?
Uelinton
GOSTEI 0
Wilson Junior

Wilson Junior

20/05/2011

Tem o componenteTListView, e veja se este link lhe ajuda https://www.devmedia.com.br/post-18010-Ler-e-Gravar--ListView-em-Delphi.html

Espero ter colaborado.
GOSTEI 0
Ureis

Ureis

20/05/2011


Tem o componenteTListView, e veja se este link lhe ajuda https://www.devmedia.com.br/post-18010-Ler-e-Gravar--ListView-em-Delphi.html

Espero ter colaborado.
 
Não me ajuda...Preciso mostrar estas informações formatadas dentro de um memo.
Ex.: 
Texto texto, texto texto texto.
Produto      PreçoArroz           10,00Feijão          20,00
Texto texto texto, texto texto.Texto texto texto texto texto.
Uelinton
GOSTEI 0
POSTAR