Here’s how to use len() function.
Description:
Get the length of a sequence.
Syntax:
A.len()
Note:
The function gets the length of sequence A.
Parameter:
A |
Sequence object |
Return value:
An integer
Example:
|
A |
|
1 |
=[1,2,4] |
|
2 |
=A1.len() |
3 |
3 |
=["a","b"].len() |
2 |
4 |
=[] |
|
5 |
=A4.len() |
0 |
Description:
Get the number of records in an in-memory table.
Syntax:
T.len()
Note:
The function gets the number of records in in-memory table T.
Parameter:
T |
An in-memory table |
Return value:
An integer
Example:
|
A |
|
1 |
=demo.query("select EID,NAME,GENDER from employee where EID< 10").cursor() |
Return cursor of retrieved data. |
2 |
=A1.memory() |
Return an in-memory table. |
3 |
=A2.len() |
9 |
Description:
Compute the length of a string.
Syntax:
len(s,cs)
Note:
The function computes the number of bytes in string s. When parameter cs, the character set, is absent, it gets the number of characters in the string and automatically uses GB2312 charset.
Parameter:
s |
A string. |
cs |
Charset; can be omitted. |
Return value:
Integer
Example:
len("esproc") |
6 |
len(" esproc ") |
8 |
len("esproc",) |
6 |
len("集算器",) |
6,字符集参数为空,使用GB2312字符集 |
len("esproc","UTF-8") |
6 |