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.