Len Function

Syntax

Len(S$)
-or-
Len(usertypevar)

Group

String

Description

Returns the number of characters in S$.

NOTE: A similar function, LenB, returns the number of bytes in the string. For a usertypevar, LenB returns the number of bytes of memory occupied by the variable data.

Parameters

Parameters Description
S$ Returns the number of chars in this string value. If this value is Null, Null is returned.
usertypevar Returns the number of bytes required to store this user type structure variable. If the user type has any dynamic String and Variant elements the length returned cannot be as big as the actual number of bytes required.

Example


Sub Main
    Debug.Print Len("Hello") ' 5
End Sub

See also

InStr( ), InStrRev( ), Left$( ), Mid$( ), Replace$( ), Right$( )