Purpose
For example, Len("ABCD属性コ構") returns 8 as the number of characters in the string, but StringByteLength("ABCD属性コ構", WindowsJapanese) returns 12 as the number of bytes for the string in WindowsJapanese charset.
Syntax
Len( expr )
expr is a variable expression. expr cannot be a Pen, Brush, Symbol, Font, or Alias.
Return Value
SmallInt
Description
The behavior of the Len() function depends on the data type of the expr parameter.
If the expr expression represents a character string, the Len() function returns the number of characters in the string.
Otherwise, if expr is a MapBasic variable, Len() returns the size of the variable, in bytes. Thus, if you pass an integer variable, Len() will return the value 4 (because each integer variable occupies 4 bytes), while if you pass a SmallInt variable, Len() will return the value 2 (because each SmallInt variable occupies 2 bytes).
Example
Dim name_length As SmallInt
name_length = Len("Boswell")
name_length now has the value 7.
See Also: