base.StringBuffer.getLength

Return the length of a string.

Syntax

getLength()
  RETURNS 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

MAIN
   DEFINE buf base.StringBuffer
   LET buf = base.StringBuffer.create()
   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
END MAIN