There are many ways to read text, here is a simple way. Ive included a few utility functions that I often use to read separated values.
There are many ways to read text, here is a simple way. I’ve included a few utility functions that I often use to read separated values. unit FileRead; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) btnParseFile: TButton; Memo1: TMemo; procedure btnParseFileClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function ListLen(List: string; const Delimiter: string = ‘,’): integer; var DL: integer; begin DL := Length(Delimiter); Result := Ord(List > ”); while Pos(Delimiter, List) > 0 do begin Delete(List, 1, Pos(Delimiter, List)+DL-1); Inc(Result); end; end; function ListGetAt(List: string; const Position: integer; const Delimiter: string = ‘,’): string; var i, NP, DL: integer; begin NP := 1; DL := Length(Delimiter); for i := 1 to Position do begin List := Copy(List, NP, Length(List)-NP+1); NP := Pos(Delimiter, List
Related Questions
- There are many ways to read text, here is a simple way. Ive included a few utility functions that I often use to read separated values.
- i read somewhere in teh text that all values are relative to the inside >of the cell...what does that mean?"
- Why use XML instead of Comma Separated Values (CSV) or ASCII text?