base.StringBuffer.getLength

Return the length of a string.

Syntax

getLength()
  RETURNING result INTEGER

Usage

Use the getLength() method to return the number of characters in the current string buffer, including trailing spaces.

The length of an empty string buffer is 0.

Important: When using byte length semantics, the string length is expressed in bytes. When using char length semantics, the unit is characters. This is matters when using a multibyte locale such as UTF-8.

Example

CALL buf.append("abc")
DISPLAY buf.getLength() -- Shows 3
-- append three spaces to the end of the string 
CALL buf.append("   ") 
DISPLAY buf.getLength() -- Shows 6