Expand description
Shared utility functions for safe string manipulation.
All functions are UTF-8-safe — they never split multi-byte characters, and the newline variant stops at line boundaries for log-preview use cases.
Functions§
- truncate_
utf8 - Truncate
sto at mostmaxbytes, landing on a valid UTF-8 character boundary. - truncate_
utf8_ line - Like
truncate_utf8but also stops at the first newline if it appears beforemax. Useful for log previews where long multi-line output should show only the first line.