string

package
v2.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ToUpperCase converts the string to uppercase
	ToUpperCase = strings.ToUpper

	// ToLowerCase converts the string to lowercase
	ToLowerCase = strings.ToLower

	// Ord implements the default ordering for strings
	Ord = ord.FromStrictCompare[string]()

	// Join joins strings
	Join = F.Curry2(F.Bind2nd[[]string, string, string])(strings.Join)

	// Equals returns a predicate that tests if a string is equal
	Equals = F.Curry2(Eq)

	// Includes returns a predicate that tests for the existence of the search string
	Includes = F.Bind2of2(strings.Contains)

	// HasPrefix returns a predicate that checks if the prefis is included in the string
	HasPrefix = F.Bind2of2(strings.HasPrefix)
)
View Source
var Monoid = M.MakeMonoid(concat, "")

Monoid is the monoid implementing string concatenation with empty string as identity

View Source
var Semigroup = S.MakeSemigroup(concat)

Semigroup is the semigroup implementing string concatenation

Functions

func Eq

func Eq(left, right string) bool

Eq tests if two strings are equal

func Format

func Format[T any](format string) func(T) string

Format applies a format string to an arbitrary value and returns a function that formats values of type T using the provided format string

func Intersperse

func Intersperse(middle string) func(string, string) string

Intersperse returns a function that concatenates two strings with a middle string in between. If either string is empty, the middle string is not added (to satisfy monoid identity laws).

func IntersperseMonoid

func IntersperseMonoid(middle string) M.Monoid[string]

IntersperseMonoid creates a monoid that concatenates strings with a middle string in between, with empty string as identity

func IntersperseSemigroup

func IntersperseSemigroup(middle string) S.Semigroup[string]

IntersperseSemigroup creates a semigroup that concatenates strings with a middle string in between

func IsEmpty

func IsEmpty(s string) bool

IsEmpty returns true if the string is empty

func IsNonEmpty

func IsNonEmpty(s string) bool

IsNonEmpty returns true if the string is not empty

func Size

func Size(s string) int

Size returns the length of the string in bytes

func ToBytes

func ToBytes(s string) []byte

ToBytes converts a string to a byte slice

func ToRunes

func ToRunes(s string) []rune

ToRunes converts a string to a rune slice

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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