On Tue, 6 Jun 2006, Alexandre Leclerc wrote:

> Hi all,
>
> here is the CSV decoding function. I have a problem with the array of
> string as the compiler is saying the type is not good when trying the
> SetLength(a). I must create a type for this.

This is perfectly normal;
otherwise the a: array of string is seen as an open array, which is
different from a dynamical array.

>
> Now I submit this procedure (because a function cant' return an array
> of string, but could probably return the type?) and I want inputs:
> - a better solution for 'array of string'
> - if no solution, is a function better?
>
> Then after I received the input I'll send a patch for sysutils (when
> the forum is up again).

Strutils you mean ?

I would like to add this function later on, I think it's useful indeed.
You may want to consider creating a WideString version, and a version
which returns an nil-terminated array of PChars.

Also, start by allocating in blocks of 10 fields. Reallocating for each
field is memory intensive. At the end you can do a setlength call with
the correct number of fields.

Just some ideas.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to