utils.shorten_string()
Shorten a string to n characters with a middle ellipsis.
Usage
utils.shorten_string(
string,
n,
)Parameters
string: str-
Input string.
n: int- Maximum length; negative values are treated as zero.
Returns
str-
Shortened string, hard-truncated when
n < 3.