stringsx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package stringsx extends the standard strings package with the log/CSV helpers services keep re-writing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstNonBlank

func FirstNonBlank(values ...string) string

FirstNonBlank returns the first value that contains any non-whitespace character, or "". Use stdlib cmp.Or for plain first-non-empty; this variant also skips values that are only spaces — the shape config fallback chains actually need.

func SplitAndTrim

func SplitAndTrim(s, sep string) []string

SplitAndTrim splits s on sep, trims whitespace from each part and drops empties — the tolerant reading of human-written lists ("a, b ,,c"). Returns nil when nothing survives. sep follows strings.Split semantics (an empty sep splits per UTF-8 rune).

func Truncate

func Truncate(s string, max int) string

Truncate returns the first max runes of s (unchanged when it already fits). A negative max reads as 0 — a computed budget gone negative should produce an empty string, not a panic.

func TruncateEllipsis

func TruncateEllipsis(s string, max int) string

TruncateEllipsis is Truncate plus a trailing "..." so readers can tell a cut string from a complete one. The ellipsis is added on top of max — it marks truncation rather than tightening the rune budget.

Types

This section is empty.

Jump to

Keyboard shortcuts

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