On 17 Mar 2002 at 14:26, Russell Whitaker wrote:
[...]
'SetLength' should work. However, I am not sure that you can use it for increasing (as opposed to decreasing) the maximum length of a string.
Be carefull not to confuse length with capacity.
Yes, I am confusing them. It would be nice to be able to increase the capacity though. Perhaps some compiler magic can just treat a call to something like "SetCapacity" as the declaration of a new variable, and then allocate the appropriate storage to it. An extension of this might be that, any attempt to assign a value that is longer than the current capacity should be treated as equivalent to: SetCapacity (s, length (newvalue)); s := newvalue; With this, you can have dynamically growing strings. Perhaps I am just being naïve in thinking that this can be done at all, or that, even if it can be done, it will not involve a major and/or undesirable changes to the compiler. But if I were to implement something like Delphi's "AnsiString", I might well consider something like this.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~African_Chief email: African_Chief@bigfoot.com