%dw 2.0
output application/json
---
sizeOf([ "a", "b", "c"])
sizeOf
sizeOf(Array<Any>): Number
Returns the number of elements in an array. It returns 0
if the array
is empty.
This version of sizeOf
takes an array or an array of arrays as input.
Other versions act on arrays of objects, strings, or binary values.
Parameters
Name | Description |
---|---|
|
The input array. The elements in the array can be any supported type. |
sizeOf(Object): Number
sizeOf(String): Number
Returns the number of characters (including white space) in an string.
Returns 0
if the string is empty.
Example
This example returns the number of characters in the input strings. Notice it
counts blank spaces in the string "my string"
and that
sizeOf("123" as Number)
returns 1
because 123
is coerced into a number,
so it is not a string.