strutil

package
v0.0.0-...-6e294cf Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package strutil contains string-related utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DedupeSortedStrings

func DedupeSortedStrings(full []string) []string

DedupeSortedStrings rewrites full in-place to drop repeated strings.

func HasPathPrefix

func HasPathPrefix(p, dir string) bool

HasPathPrefix returns true if p equals or is under dir. The caller is responsible for ensuring that paths have been cleaned.

func Plural

func Plural(n int, singular, plural string) string

Plural returns "1 [singular]" if n is 1 and "[n] [plural]" otherwise.

func TrimPathPrefix

func TrimPathPrefix(p, dir string) string

TrimPathPrefix trims dir (plus a path separator) from the beginning of p if present. If p equals dir, an empty string is returned. The caller is responsible for ensuring that paths have been cleaned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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