Handlebars length
Handlebars length: counts the characters in a string or the items in an array.
Next
Runtime verified
Test scripts included
Counts the characters in a string or the items in an array.
Syntax
{{length subject}}
Returns integer.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subject |
any | Yes | String or array to measure. |
Example
Tested in a Marketing Cloud Next email on 2026-11-22:
{{length "hello"}}renders5, as documented.{{length "a b"}}renders3, as documented.
Show Next test script
Marketing Cloud Next
Works as documented
Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.
See also
- AMPscript
Length— the AMPscript equivalent - AMPscript
RowCount— does a similar job in AMPscript, with a different call shape - Official reference