STR_LENGTH, STR_LNG

Use either the STR_LENGTH or the STR_LNG script function to obtain the length of a string in characters (not in bytes). These two script functions are functionally identical.

Syntax

STR_LENGTH (String)

STR_LNG (String)

Parameters

Parameter Description Format / Allowed Values
String Alphanumeric string whose character length you want to retrieve. Script literal or script variable

Return Codes

The function returns the number of string characters (not bytes).

Examples

The following script returns the length of the string (2):

: SET &LENGTH# = STR_LENGTH ("AE")

The following example returns 18 as the number of characters:

: SET &number# = STR_LENGTH (" Automic software ")

The following example checks the value (string) that is assigned to a script variable, and retrieves the length of the string:

: SET &number# = STR_LENGTH (&string)

The following script returns the length of the string (13):

: SET &LENGTH# = STR_LENGTH ("Doppelgänger")

See also: