Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
Public Shared Function Len( _ ByVal Expression As { Boolean | Byte | Char | Double | Integer | Long | Object | Short | Single | String | DateTime | Decimal } _ ) As Integer
With user-defined types and Object variables, the Len function returns the size as it will be written to the file. If an Object contains a String, it will return the length of the string. If an Object contains any other type, it will return the size of the object as it will be written to the file.
Note The Len function may not be able to determine the actual number of storage bytes required when used with variable-length strings in user-defined data types.
This example uses Len to return the number of characters in a string.
Dim MyString As String Dim MyLen As Integer MyString = "Hello World" ' Initializes variable. MyLen =Len(
MyString)
' Returns 11.