TStringlist as Delphi

Can I use TStringlist in the code editor for delimitedtext?
I tried commatext, but has his limits when a string has more comma's than needed

Example : 1,2,3,My dog is tiny, but very friendly,ww,ee,rr

result : 7 entries, but should be 6

Comments

  • edited February 2019
    Can I use TStringlist in the code editor for delimitedtext?
    I tried commatext, but has his limits when a string has more comma's than needed

    Example : 1,2,3,My dog is tiny, but very friendly,ww,ee,rr

    result : 7 entries, but should be 6


    Test:
    procedure Test();
    var
      i    : Integer;                                   
      fSL  : TStringList;
      fStr : String;
    begin
      
      fStr := '';                                 
      fSL := TstringList.Create();
      try
        fSL.CommaText := '1,2,3,"My dog is tiny, but very friendly",ww,ee,rr';
        for i := 0 to fSL.Count - 1 do
          fStr := Format('%s%3d. %s'#10,[fStr, i + 1, fSL[i]]);                                                      
        fStr := fStr + '=======' + #10'Total = ' + VarToStr(fSL.Count);
        ShowMessage('Comma text: '+ fSL.CommaText
                    +#10'-----'
                    +#10 + fStr);
      finally
        fSL.Free();
      end;                  
    end;
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.