Truncate String with Ellipsis

Shortens a string passed in the "text" argument down to the number of characters passed in the second argument ("length" - default to 10). If the specified number of characters is less than the length of the string, an ellipsis (…) is appended to the string.

Custom ellipsis

The function takes an optional third argument "ellipsis" that specifies the sequence of characters to be appended to the truncated string. By default this is an ellipsis (…), but you can specify a different sequence.

No ellipsis

You can truncate to the exact number of characters specified by the first argument and avoid showing trailing characters by passing a blank string as the third argument ("ellipsis").