Examples: Len function

Example 1

' The length of a string, in characters
Dim theString As String
theString$ = "alphabet"
Print Len(theString$) ' Output:  8
' The number of bytes used to hold a Single variable
Dim singleVar As Single
Print Len(singleVar!) ' Output:  4

Example 2

' User-defined data type with variable-length String member
Type OrderInfo
   ordID As String * 6
   custName As String
End Type
' An instance of the user-defined data type
Dim ord As OrderInfo
ord.ordID$ = "OR1234"
ord.custName$ = "John R. Smith"
' Total length of the ord's members is 19.
Print Len(ord.ordID$) + Len(ord.custName)
' Length of ord is 16.
Print Len(ord)