Length
→ numberReturns the number of characters in a string.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.Length(value)
1 argument
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value |
string | Yes | String to measure |
Examples
var str = "Hello!";
var len = Platform.Function.Length(str);
Write(len); // 6
// Validate minimum length
var password = Platform.Request.GetFormData("password");
if (Platform.Function.Length(password) < 8) {
Write("Password must be at least 8 characters.");
}
Notes
This is equivalent to str.length in JavaScript, but provided as a Platform function for consistency with other string operations. Both approaches work in SSJS.