[Gambas-user] import data from text file and popolate a 2D array

Jussi Lahtinen jussi.lahtinen at gmail.com
Tue Aug 31 15:50:16 CEST 2021


It should be fairly easy by using split functions. Quickly thinking first
by "{" and then after a little cleaning with ",".
http://gambaswiki.org/wiki/lang/split

Jussi

On Tue, Aug 31, 2021 at 2:54 PM Roberto Premoli <roberto.premoli at tiscali.it>
wrote:

> hello. i run gambas 3.12-2 (debian 10 stable)
>
> I have a list of raw data into a text file. It is a database as follow:
>
> [{field1,field2,...fieldN}},{field1,field2,...fieldN}},...{field1,field2,...fieldN}}]
>
> each line starts with "{", end with "}}" and inside each line, the
> fields are separated by ",".
>
> i wish to read the text file as input, get each "block" {...}}, and
> split it into fields to populate a database bidimentiona array (about
> 6000 linees and 20 fields in each line).
> I can elaborate all file database searching the "marker" ( the "{", the
> "," and the "}},") but I suppose it will be slow compared to a
> dedicated command (if it exist).
> I write here asking if there is some "magic trick" to elaborate strings
> that allow me to speed up all the process and avoid me to write
> a dedicated funcion.
>
> Thanks,
> Roberto
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210831/eb8d0817/attachment.htm>


More information about the User mailing list