Returns a portion of a string, beginning at a specified character position. You can optionally specify the length of the substring to return.
Availability
<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>✅ Yes</td> </tr> </table>This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).
Syntax
Substring(sourceString,
startPosition,
substringLength)
The Substring() function has three parameters:
sourceString(string): Required. The string that contains the substring you want to identify.startPosition(number): Required. The character position to begin the substring. If the specified character position exceeds the length ofsourceString, the function returns an empty string.substringLength(number): The number of characters to return after the initial character. If you don’t specify a length, the substring continues to the end of the string.
Usage
This example uses the Substring() function to remove part of a string of text and return the result.
%%[
Var @rewardsSegment, @rewardsTier
Set @rewardsSegment = "0312F-Gold"
Set @rewardsTier = Substring(@rewardsSegment, 7)
]%%
<p>Thank you for being a %%=v(@rewardsTier)=%% rewards member!</p>
The example returns the specified substring.
Thank you for being a Gold rewards member!