Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

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.

0
Posted

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.

0

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

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123