Skip to content

length()

Functionality

Returns the length of the string (number of characters) or count of array elements.

Syntax

How does it work?

The length() function returns the number of characters in the string datatype or the number the elements in array datatype.

if the value does not exist or null, it will return default 0.

Example

coffeeshop(base class) language properties

TypeNameValue
strnamesample coffeeshop
array(str)testimonials['very good coffee', 'awesome ambiance']

source

1
2
3
4
5
6
<div>
    <!-- for str datatyp it will return number of characters -->
    <span></span>
    <!--for array datatype it will return number of elements present -->
    <span></span>
</div>

output

1
2
3
4
<div>
    <span>17</span>
    <span>2</span>
</div>