%dw 2.0
output application/json
---
sizeOf([ "a", "b", "c"])
sizeOf
DataWeave 2.2 is compatible and bundled with Mule 4.2. This version of Mule reached its End of Life on May 2, 2023, when Extended Support ended. Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted. MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements. |
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.