Examples Delphi

"Huge strings" introduced in Delphi 2.x can adjust their string size on demand. However, if you have a need to preset the size of a huge string, before passing to a function expecting a string buffer of a certain size for example, try the "SetLength()" function:

{ size of the following string is 3 }
{ 3 = two characters plus length or }
{ end-of-string holder }
sHugeString := 'hi';
{ set the size without assigning }
SetLength( sHugeString, 1024 );
{ sHugeString is now 1024 chars long }