textutil

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 0 Imported by: 0

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

func TruncateRunes(s string, max int, suffix string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL