String.Length

From Xojo Documentation

Method

Returns the number of characters in the specified string.

Syntax

result=stringVariable.Length

Part Type Description
result Integer The number of characters in string.
stringVariable String Any variable of type String.

Notes

If you need the number of bytes in the string rather than the number of characters, use the String.Bytes function.

Technically, Length returns the number of code points rather than the number of characters. For example, if two code points are presented visually as a single character, its length will be reported as "2", not "1".

Examples

This example uses the Length function to return the number of characters in a string.

Var s As String
s = "Hello World"
n = s.Length // returns 11

See Also

String for a complete list of functions.