Help us shape the future of Go! Take the 2026 Go Developer Survey

textutil

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package textutil trims byte-capped output back to UTF-8 rune boundaries. A cap applied at an arbitrary byte can split a multibyte rune anywhere: leave the lead byte, some continuation bytes, or cut clean. A split rune would surface as U+FFFD in every downstream consumer (JSON encoding, terminal rendering), so capped output is trimmed before use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrimEnd

func TrimEnd(s string) string

TrimEnd drops a trailing partial rune (at most one rune's bytes).

func TrimStart

func TrimStart(s string) string

TrimStart drops a leading partial rune (at most one rune's bytes).

func Truncate

func Truncate(s string, max int) string

Truncate cuts s to at most max bytes, then drops a trailing partial rune so the result is valid at its end.

Types

This section is empty.

Jump to

Keyboard shortcuts

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