The Trim function removes and leading or trailing spaces in a string. A good use case is using Trim on any malformed data that may have been imported or inserted in a data extension with leading spaces. For example, if you are using a free form text field where the data is captured in a data extension, users who enter in information may inadvertently add spaces within the form.
Example:
%%[
set @response = Trim([Input])
]%%
This is your response: %%=v(@response)=%%,
Data Extension:
EmailAddress | Input |
test@test.com | ‘ Hello. ‘ |
Output:
This is your response: Hello.
Explanation:
The Trim function removes any leading spaces and his is helpful if your data is not formatted correctly in the data extension.