Length()
Returns the number of characters in a string.
| Marketing Cloud Engagement | ✅ Yes |
| Marketing Cloud Next | ✅ Yes |
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).
The Length function has one parameter:
sourceString(string): Required. The string that you want to find the length of.
To use this function, pass it a string. This example uses the Length() function to determine if the length of a URL exceeds a certain threshold. If it does, then the function passes the URL to the WrapLongUrl() function to obtain a shortened URL. Otherwise, the function uses the original URL.
The example outputs an image with a src URL that varies based on the length of the source URL.