hstrings

package
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualAny

func EqualAny(a string, b ...string) bool

EqualAny returns whether a string is equal to any of the given strings.

func GetOrCompileRegexp

func GetOrCompileRegexp(pattern string) (re *regexp.Regexp, err error)

GetOrCompileRegexp retrieves a regexp object from the cache based upon the pattern. If the pattern is not found in the cache, the pattern is compiled and added to the cache.

func InSlicEqualFold

func InSlicEqualFold(arr []string, el string) bool

InSlicEqualFold checks if a string is an element of a slice of strings and returns a boolean value. It uses strings.EqualFold to compare.

func InSlice

func InSlice(arr []string, el string) bool

InSlice checks if a string is an element of a slice of strings and returns a boolean value.

func ToString

func ToString(v any) (string, bool)

ToString converts the given value to a string. Note that this is a more strict version compared to cast.ToString, as it will not try to convert numeric values to strings, but only accept strings or fmt.Stringer.

Types

type StringEqualFold

type StringEqualFold string

StringEqualFold is a string that implements the compare.Eqer interface and considers two strings equal if they are equal when folded to lower case. The compare.Eqer interface is used in Hugo to compare values in templates (e.g. using the eq template function).

func (StringEqualFold) Eq

func (s StringEqualFold) Eq(s2 any) bool

func (StringEqualFold) EqualFold

func (s StringEqualFold) EqualFold(s2 string) bool

func (StringEqualFold) String

func (s StringEqualFold) String() string

type Tuple

type Tuple struct {
	First  string
	Second string
}

Jump to

Keyboard shortcuts

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