StrSize Function

Action

Returns the size of a string's currently allocated memory buffer.

Include file

Kernel.bdh

Syntax

StrSize( in sString : string ): number;

Return value

  • the amount of memory the string has currently allocated

Parameter Description
sString String whose memory size is to be retrieved.

Example

dcltrans
  transaction TMain
  var
    sString : string;
  begin
    Print("Allocated memory: " + string(StrSize(sString)) + " Bytes");
      
 StrResize(sString, 1024);
    Print("Allocated memory: " + string(StrSize(sString)) + " Bytes");
    StrResize(sString, 10, 100);
    Print("Allocated memory: " + string(StrSize(sString)) + " Bytes");
  end TMain;

Output

Allocated memory: 254 Bytes
Allocated memory: 1024 Bytes
Allocated memory: 100 Bytes