util

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllBlank added in v0.47.1

func AllBlank(lines []string) bool

func Contains added in v0.33.4

func Contains(s, substr string) bool

func DedupeNonEmptyStrings

func DedupeNonEmptyStrings(values []string) []string

DedupeNonEmptyStrings returns a copy of values without empty strings or duplicates, preserving order.

func DedupeSortedStrings added in v0.17.1

func DedupeSortedStrings(values []string) []string

DedupeSortedStrings removes consecutive duplicates from a sorted slice.

func ExpandHome added in v1.1.0

func ExpandHome(path string) string

func FirstTrimmed added in v0.28.1

func FirstTrimmed(values ...string) string

func FoldLines added in v0.53.1

func FoldLines(s string) string

FoldLines trims each line, drops blank lines, and joins the rest with spaces. A string without line breaks is returned unchanged.

func HasPrefix added in v0.33.4

func HasPrefix(s, prefix string) bool

func Lower added in v0.37.1

func Lower(s string) string

func LowerTrim added in v0.28.1

func LowerTrim(s string) string

func SameFile added in v0.49.1

func SameFile(a, b string) bool

SameFile reports whether two paths name one file on disk. Use it instead of SamePath when the same file can reach the caller under more than one name, as happens through a symlink or on a case insensitive filesystem.

func SamePath added in v0.35.1

func SamePath(a, b string) bool

SamePath reports whether two non-empty paths resolve to the same lexical path.

It does not stat files or resolve symlinks; use os.SameFile with os.Stat results when physical file identity is required.

func SamePathOrBothEmpty added in v0.35.1

func SamePathOrBothEmpty(a, b string) bool

SamePathOrBothEmpty reports whether a and b are both empty or name the same path.

func SortedKeys added in v0.23.6

func SortedKeys[M ~map[K]V, K ~string, V any](m M) []K

func Trim added in v0.28.1

func Trim(s string) string

func TrimLeadingOnce added in v0.28.1

func TrimLeadingOnce(s string) string

func TrimLeft added in v0.28.1

func TrimLeft(s string) string

func TrimRight added in v0.28.1

func TrimRight(s string) string

func UpperTrim added in v0.28.1

func UpperTrim(s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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