Crate unicode_ellipsis

Source
Expand description

A crate to truncate Unicode strings to a certain width, automatically adding an ellipsis if the string is too long.

Additionally contains some helper functions regarding string and grapheme width.

Functionsยง

grapheme_width
Returns the width of a single grapheme g. This takes into account some things like joiners when calculating width.
str_width
Returns the width of a str s, breaking the string down into multiple graphemes. This takes into account some things like joiners when calculating width.
truncate_str
Truncates a string to the specified width with a trailing ellipsis character.
truncate_str_leading
Truncates a string to the specified width with a leading ellipsis character.