len()

Read(728) 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 a memory table.

Syntax:

T.len()

Note:

The function gets the number of records in memory table T.

Parameter:

T

A 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 a 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 the string’s length in 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