{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package textutil\n\nPackage textutil holds small string helpers shared across packages.\n\nThe 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.\n\n## Functions\n\n```go\nfunc ClipBytes(s string, max int) string\n```\nClipBytes 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).\n\n```go\nfunc ClipRunes(s string, max int) string\n```\nClipRunes returns s truncated to at most max runes.\n\n```go\nfunc ClipRunesEllipsis(s string, max int) string\n```\nClipRunesEllipsis returns s truncated to at most max runes, appending an ellipsis when truncation occurred.\n\n","path":"github.com/memcode-ai/memcode/internal/textutil","name":"textutil","synopsis":"Package textutil holds small string helpers shared across packages.","isRedistributable":true}
