Documentation
¶
Overview ¶
Package textutil provides small string helpers shared across packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TruncateRunes ¶
TruncateRunes caps s at max runes, appending suffix when it was cut. Truncation happens on rune (not byte) boundaries: much of the bot's content is Russian, and a byte-level slice can split a multibyte rune and corrupt the tail.
Allocation-free until the cut: callers pass multi-megabyte strings on hot paths (serialized LLM request bodies with base64 media), where a []rune(s) conversion would transiently cost ~4x the input size.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.