Trim
→ stringRemoves leading and trailing whitespace from a string.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.Trim(value)
1 argument
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value |
string | Yes | String to trim |
Examples
var input = " Jane Smith ";
var trimmed = Platform.Function.Trim(input);
Write(trimmed); // "Jane Smith"
// Trim form input before storing
var email = Platform.Function.Trim(Platform.Request.GetFormData("email"));
Notes
Platform.Function.Trim() is more reliable than String.prototype.trim() in SSJS, since String.prototype.trim is not available without a polyfill.