croptext(
text
,
length
)

The croptext( function crops text to a specified length. If the text was already shorter than the specified length, it is left unchanged. If it is longer, the text is cut off and an ellipsis is added on the end.


Parameters

This function has two parameters:

text – the original text.

length – maximum length of the text


Description

This function crops text to a specified length. If the text was already shorter than the specified length, it is left unchanged. If it is longer, the text is cut off and an ellipsis is added on the end.

croptext("abc",4) ☞ abc
croptext("abcd",4) ☞ abcd
croptext("abcde",4) ☞ abc…

Notice that the maximum length of the output is the specified length, including the ellipsis if the text is longer than the specified length.


See Also


History

VersionStatusNotes
10.2NewNew in this version.