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

text

package
v0.19.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeadBytes added in v0.9.1

func HeadBytes(s string, n int) string

func HeadLines added in v0.17.6

func HeadLines(s string, n int) string

HeadLines returns the longest prefix of s that fits in n bytes and ends at a line boundary, without the trailing newline. A single line longer than n is cut at a byte boundary instead, so the result is never empty for non-empty input and a positive n.

func LineCount added in v0.16.10

func LineCount(value string) int

LineCount counts logical lines, excluding the empty suffix after a final newline.

func TailBytes added in v0.9.1

func TailBytes(s string, n int) string

func TailLines added in v0.17.6

func TailLines(s string, n int) string

TailLines returns the longest suffix of s that fits in n bytes and starts at a line boundary. A single line longer than n is cut at a byte boundary instead, so the result is never empty for non-empty input and a positive n.

func TruncateHead added in v0.6.9

func TruncateHead(s string, maxBytes int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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