textutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeJSON

func SanitizeJSON(s string) string

SanitizeJSON fixes common JSON issues in LLM output: literal control characters inside string values and invalid escape sequences like \s (JSON only allows \", \\, \/, \b, \f, \n, \r, \t, \uXXXX).

func Truncate

func Truncate(s string, maxLen int, suffix string) string

Truncate returns s unchanged if len(s) <= maxLen (measured in bytes). Otherwise it cuts at maxLen, walks back to avoid splitting a multi-byte UTF-8 sequence, and appends suffix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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