length ... (parameter set function)

Prev Next

Function Names

length

Description

Returns number of characters. If the value provided is not a string, then it will be converted to a string first.
Attention: For numerals and dates with available string context, the string will be used.

A simpler approach is to use {} behind the parameter set value, referred as length of parameter sets.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
parameter set input parameter set

Attention: If 1st parameter is not a parameter set, please refer to length [string function] instead.

Return value

TypeDescription
numeral Length

Number of elements (nested elements are not counted)

Examples

      echo( length( {a,b,1} ) );  // 3 elements
      echo( length( {a,{b,2,3}} ) );  // 2 elements (nested ones are not counted)
      echo( length( {} ) );       // 0 elements (empty set)
      echo( length( {{}} ) );     // 1 elements (contains 1 element which is a nested empty set)

Output

3
2
0
1
Try it yourself: Open LIB_Function_length_.b4p in B4P_Examples.zip. Decompress before use.

See also

length [string function]
length of parameter sets