Expand description
Truncation utilities for safe string handling.
Provides functions to truncate strings while respecting UTF-8 boundaries.
Functions§
- find_
boundary - Find a safe UTF-8 boundary position. Returns the largest position <= max that is a valid char boundary.
- truncate_
bytes - Truncate string to max bytes, respecting UTF-8 boundaries. Does not add any suffix.
- truncate_
chars - Truncate string to max characters (not bytes). Useful for display purposes where visual length matters.
- truncate_
string_ in_ place - Truncate string and modify in place (for String types).
- truncate_
with_ suffix - Truncate string to max bytes with “…” suffix. Respects UTF-8 boundaries.