stringtool

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package stringtool provides string utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cat

func Cat(strs ...string) string

Cat concatenates strings. It is intended to used in the core executing path for performance optimization. fmt.Printf is still recommended for readability.

func DeleteStrInSlice

func DeleteStrInSlice(slice []string, str string) []string

DeleteStrInSlice deletes the matched string in the slice.

func IsAllEmpty

func IsAllEmpty(strs ...string) bool

IsAllEmpty returns whether all strings are empty.

func IsAnyEmpty

func IsAnyEmpty(strs ...string) bool

IsAnyEmpty returns whether any string is empty.

func StrInSlice

func StrInSlice(str string, slice []string) bool

StrInSlice returns whether the string is in the slice.

Types

type StringMatcher

type StringMatcher struct {
	Exact  string `json:"exact,omitempty"`
	Prefix string `json:"prefix,omitempty"`
	RegEx  string `json:"regex,omitempty" jsonschema:"format=regexp"`
	Empty  bool   `json:"empty,omitempty"`
	// contains filtered or unexported fields
}

StringMatcher defines the match rule of a string

func (*StringMatcher) Init

func (sm *StringMatcher) Init()

Init initializes the StringMatcher.

func (*StringMatcher) Match

func (sm *StringMatcher) Match(value string) bool

Match matches a string.

func (*StringMatcher) MatchAny

func (sm *StringMatcher) MatchAny(values []string) bool

MatchAny return true if any of the values matches.

func (*StringMatcher) Validate

func (sm *StringMatcher) Validate() error

Validate validates the StringMatcher.

Jump to

Keyboard shortcuts

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