Skip to main content

truncatewords

Truncate a string after arg number of words. Remove newlines within the string.

def truncatewords(
value: string,
arg: integer
) - > string

Truncate a string after arg number of words. Remove newlines within the string.

Parameters

NameTypeDescription
valuestringThe input text to be truncated.
argintegerThe maximum number of words to retain in the string.

Returns

TypeDescription
stringThe truncated string followed by an ellipsis if the word count was exceeded, or the original string if the argument is invalid.