Skip to content

Length

See Also: String Functions, String, String command, SizeOfString, SizeOfWString, VariantStringLength

Purpose

Length returns the number of code points in a string.

Return Type

Integer

Syntax

(Length({string-value}))

What It Does

Length returns the number of code points in {string-value}, including leading and trailing spaces, if present. Note that some characters (especially diacritics) are built up of multiple code points.

String sMeasure
Integer iLength
Move " 2 4 6" to sMeasure
Move (Length(sMeasure)) to iLength

In this example, the length of the string variable sMeasure (6) is moved to iLength.

Notes

  • When an ASCII or TEXT database table column is passed to the length function, the defined length of the column is returned rather than the number of characters that are stored there. This is because string-type database columns are padded with spaces to the full defined length of the column. You can use trim to remove the extra spaces:
Integer iLength
Move (Length(Trim(Customer.Name))) to iLength