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

runechunk

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package runechunk splits and cuts platform text at readable rune boundaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFence added in v0.14.0

func IsFence(trimmed string, inFence bool) bool

IsFence reports whether trimmed is a pure code-fence marker: bare ``` always, or ``` plus a single language token when opening a fence. Closing fences carry no info string (CommonMark), and any line with more backticks or extra words is inline content, not a fence.

func LenUTF16 added in v0.14.0

func LenUTF16(s string) int

LenUTF16 counts text in UTF-16 code units, as required by platform limits.

func Split

func Split(text string, limit int) []string

Split cuts text into chunks of at most limit runes, preferring paragraph breaks, then line breaks, then spaces, then a hard cut. Empty input or a non-positive limit yields no chunks.

func Truncate added in v0.14.0

func Truncate(s string, limit int) string

Truncate cuts s to at most limit runes.

func TruncateUTF16 added in v0.14.0

func TruncateUTF16(s string, limit int) string

TruncateUTF16 cuts at a rune boundary within limit UTF-16 code units.

Types

This section is empty.

Jump to

Keyboard shortcuts

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