Documentation
¶
Overview ¶
Package textutil holds small string helpers shared across packages.
The truncation helpers exist because ad-hoc byte slicing (s[:n]) can split a multibyte UTF-8 rune, producing invalid UTF-8 in transcripts, tool results, and terminal output. Use these instead of slicing by byte.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClipBytes ¶
ClipBytes returns s truncated to at most max bytes without splitting a UTF-8 rune: the cut backs up to the nearest rune boundary. Use when the budget is genuinely in bytes (wire limits, log caps).
func ClipRunesEllipsis ¶
ClipRunesEllipsis returns s truncated to at most max runes, appending an ellipsis when truncation occurred.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.