stringutil

package
v2.0.0-alpha.33 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndentTextWithMaxLength

func IndentTextWithMaxLength(text, indent string, maxTextLineCharWidth int, isIndentFirstLine bool) string

IndentTextWithMaxLength formats text with indentation and wraps lines longer than maxTextLineCharWidth. Each line is prefixed with indent string. If isIndentFirstLine is false, the first line will not be indented.

func LastNLines

func LastNLines(s string, n int) string

LastNLines returns the last n lines from the input string. It trims leading and trailing newlines before splitting. If the string has fewer than n lines, returns all lines.

func MaxFirstCharsWithDots

func MaxFirstCharsWithDots(inStr string, maxCharCount int) string

MaxFirstCharsWithDots returns the first maxCharCount characters from inStr. If the string is longer than maxCharCount, it appends "..." to indicate truncation. Returns empty string if maxCharCount < 4.

func MaxLastCharsWithDots

func MaxLastCharsWithDots(inStr string, maxCharCount int) string

MaxLastCharsWithDots returns the last maxCharCount characters from inStr. If the string is longer than maxCharCount, it prepends "..." to indicate truncation. Returns empty string if maxCharCount < 4.

func ReadFirstLine

func ReadFirstLine(s string, isIgnoreLeadingEmptyLines bool) string

ReadFirstLine returns the first line from the input string. If isIgnoreLeadingEmptyLines is true, it skips empty lines and returns the first non-empty line.

Types

This section is empty.

Jump to

Keyboard shortcuts

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