Len Function

Returns the number of characters in the specified String.

Syntax

result = Len( string )

result = stringVariable.Len( )


Parameters

string

String

Any valid string expression.


Return Value

Result

Integer

The number of characters in 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.

Dim n As Integer
n=Len("Hello world") //returns 11

See Also

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