Getting started Community Training Tutorials Documentation APIs, AI & Tools
%dw 2.0
output application/json
---
sizeOf([ "a", "b", "c"])
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.
| Name | Description |
|---|---|
|
The input array. The elements in the array can be any supported type. |
Returns the size of a binary payload in bytes. Returns 0 if the payload is empty.
This example returns the number of bytes in the binary payload. Notice how multi-byte UTF-8 characters take up more than one byte.
Returns the number of characters (including white space) in an string.
Returns 0 if the string is empty.
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.