len()

Read(2268) Label: len,

Here’s how to use len() function.

A.len ()

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

T.len()

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

len()

Description:

Compute the length of a string.

Syntax:

len(s,cs)

Note:

The function computes the length of a string. Calculate length of string's corresponding Unicode if parameter cs is absent.

Parameter:

s

String for which you want to compute the length

cs

Charset; can be omitted

Return value:

An integer

Example:

len("esproc")

6

len(" esproc ")

8

len("esproc",)

6

len("esproc","UTF-8")

6