Skip to main content

.cap_str_len()

A function to shorten or cap a string to a specified length.

Syntax

#fs.scripts.lib().cap_str_len(str, length);

Parameters

str

The string to be length capped.

length

The numerical length the string should be shorted or capped to.

Return

Returns a string.

Example

function(context, args) {
const l = #fs.scripts.lib();
const my_string = "I am a string whose length will be capped.";

return l.cap_str_len(my_string, 13);
}