stringnorm

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(normalize Normalizer, value string) string

Apply runs normalize when present and otherwise returns value unchanged.

func Set

func Set(values []string, normalize Normalizer) map[string]struct{}

Set returns normalized non-empty strings as a set. It preserves nil for empty input or when every normalized value is empty.

func SortedSetValues

func SortedSetValues(values map[string]struct{}, normalize Normalizer) []string

SortedSetValues returns the sorted non-empty keys in values after optional normalization.

func Unique

func Unique(values []string, normalize Normalizer, sortOutput bool) []string

Unique returns non-empty normalized strings, preserving first-seen order unless sortOutput is true.

Types

type Normalizer

type Normalizer func(string) string

Normalizer is the shared contract for callers that canonicalize string values before set/unique operations. A nil Normalizer preserves values as-is.

Jump to

Keyboard shortcuts

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