Len

From Xojo Documentation

Revision as of 19:32, 7 April 2021 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
fa-info-circle-32.png
Len (the global function) is here for compatibility with Visual Basic. You should instead use String.Length.
Method

Returns the number of characters in the specified string.

Syntax

result=Len(string)
OR
result=stringVariable.Len

Part Type Description
result Integer The number of characters in string.
string String Any valid string expression.
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 LenB function.

Examples

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

Var n As Integer
n = Len("Hello world") // returns 11
Var s As String
s = "Hello World"
n = s.Len // returns 11

See Also

Asc, Chr, InStr, LenB, Mid, Right functions.