[Lazarus] In search of a component for holding a table of strings

Bart bartjunk64 at gmail.com
Thu Jan 5 16:35:02 CET 2017


On 1/5/17, Michael Schnell via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> A two dimensional dynamic array.
>
> If he wants "add" and "delete" etc functions, he can easily embed same
> in a class, plus using a two dimensional array default property for comfort.

Yes, that's what I ended up with.
I constructed a TStringTable class that does all I need (and more):
- insert, add, delete rows/cols
- autogrow colcount (with insertrow)
- exchange rows/cols
- get/set rows/cols
- property Cells[ACol, ARow]: string (read/write)

It can be found here:
http://svn.code.sf.net/p/flyingsheep/code/trunk/MijnLib/stringtable.pp

Implementation can probably be faster (I use dumb for loops to move
things around, where maybe I could have used move(), but failed and
gave up).

It does not scale very well (due to numerous setlength() calls), but
filling a 1000x1000 TStringTable just cost me 76 ms.
A 5000x5000 table however cost me 1248 ms.

B.t.w. for testing purposes I tried to set up a 10000x10000 array of
array of string, but the program died on me without a sign of a single
exception.

Bart


More information about the Lazarus mailing list