Summary
Char()
Concat()
Format()
IndexOf()
Length()
Lowercase()
Propercase()
RegExMatch()
ReplaceList()
Replace()
Substring()
StringToHex()
Trim()
Uppercase()
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).
1Length(sourceString)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.
1%%[
2 Var @imageUrl, @imageUrlLength
3 /* A very long string that contains 1200 characters */
4 Set @imageUrl = "https://cdn.example.com/images/0800fc577294c34...e0b28ad2839435945/28ad2839435945.png"
5 Set @imageUrlLength = Length(@imageUrl)
6
7 If @imageUrlLength >= 975 then
8]%%
9
10<img src="%%=WrapLongUrl(@imageUrl)=%%" />
11
12%%[ Else ]%%
13
14<img src="%%=v(@imageUrl)=%%" />
15
16%%[ EndIf ]%%The example outputs an image with a src URL that varies based on the length of the source URL.