
354
|
Chapter 12: The Language Reference
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Description
The Len function returns the number of characters within a string or the storage size in
bytes for a given variable.
Usage at a Glance
•Ifexpression contains Nothing, Len returns 0.
• For string variables, Len returns the number of characters in the string. For all
other types,
Len returns the number of bytes required to store the content.
•Ifexpression is an array, you must also specify a valid subscript. Len cannot be
used to determine the total number of elements in, or the total size of, an array.
•
Len cannot accurately report the number of bytes required to store structures that
contain variable-length strings. If you need to know how many bytes of storage
space will be required by a structure that includes string members, you can fix the
length of the strings by using the
<VBFixedString(length)> attribute in the
Structure statement. For details, see the Structure...End Structure Statement entry.
• For strings, Len is functionally similar to the String data type’s Length public
instance method, although there are some differences for empty and nonstandard
strings.
See Also
Structure...End Structure Statement, VBFixedString Attribute
Like Operator
Syntax
Dim result As Boolean = string Like pattern
string (required; String)
The string to be ...