length - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


length

length of an object

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Compatibility

Calling Sequence

length(expr)

length[shortname](expr)

Parameters

expr

-

expression

Description

• 

The length(expr) function returns the length of expr.

• 

If expr is an integer, the number of decimal digits is returned (where the length of zero is defined to be zero and the length of a negative integer is defined to be the same as the length of the absolute value of the integer).

• 

If expr is a string, the number of characters in expr is returned.

• 

If expr is a rtable object, the number of words of storage occupied by the rtable is returned (including the data, the attributes, and the data structure itself).

• 

For other objects, the length of each operand of expr is computed recursively and added to the number of words used to represent expr. In this way, the measure of the size of expr is returned.

• 

If the shortname literal is specified, then the length of the expression is computed with all symbols (not strings) in the expression being considered to be 1 character in length.

• 

To find the number of elements of a list, set, or Array, use the numelems command.

Thread Safety

• 

The length command is thread-safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

Examples

length0

0

(1)

length11

2

(2)

length14.5

7

(3)

lengthabc

3

(4)

lengthx+2y

9

(5)

lengthx_initial+2y_initial

25

(6)

lengthshortnamex_initial+2y_initial

9

(7)

Compatibility

• 

The length command was updated in Maple 2022.

• 

The shortname option was introduced in Maple 2022.

• 

For more information on Maple 2022 changes, see Updates in Maple 2022.

See Also

numelems

StringTools[Length]