(page requirements)
Keywords
Downloads

Resizing huge strings

"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 }
Listing #1 : Delphi code. Download hugestr (0.29 KB).
 
 
Applicable Keywords : Delphi, Delphi 2.x
 
 
 
Copyright © 2009 Chami.com. All Rights Reserved. | Advertise | Created in HTML Kit editor