str

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(a, b []string) []string

func CompareVersion

func CompareVersion(v1, v2 string) (int, error)

CompareVersion 对比 2 个版本昊, v1 > v2 返回 1, v1 < v2 返回 -1, v1 == v2 返回 0

func Contain

func Contain(list []string, s string) bool

Contain check if string s is in the list

func ContainAll

func ContainAll(list []string, s ...string) bool

ContainAll check if list contain all items

func ContainAny

func ContainAny(list []string, s ...string) bool

ContainAny check if list contain any item

func DecodeId

func DecodeId(prefix string, s string) (uint64, error)

func DecodeIdWithKey

func DecodeIdWithKey(prefix string, s string, key []byte) (uint64, error)

func Distinct

func Distinct(arr []string) []string

Distinct 对字符串数组进行去重

func EncodeId

func EncodeId(prefix string, n uint64) string

func EncodeIdWithKey

func EncodeIdWithKey(prefix string, n uint64, key []byte) string

func Equal

func Equal(a, b []string) bool

Equal 判断 2 个字符串数组是否相同 不考虑排序情况,也就是说 [a,b] == [b,a]

func Match

func Match(pattern, s string) bool

Match 模糊匹配

func MatchDst

func MatchDst(pattern, s string, dst []string) ([]string, bool)

MatchDst 模糊匹配

func ParseSearch

func ParseSearch(query string, keys ...string) (map[string]string, string)

ParseSearch 解析搜索内容. 比如将 key1=value1 key2=value2 some other info 解析成 {key1:values,key2:values} 和 "some other info" 并返回

func Rand

func Rand(n int) string

Rand 返回固定长度的随机字符串

func ReplaceVars

func ReplaceVars(s string, vars map[string]any) string

func Split

func Split(s string, sep string) []string

func TrimAny

func TrimAny(input string, suffixes []string) (string, bool)

func Union

func Union(a, b []string) []string

Types

type String

type String string

func (*String) Scan

func (s *String) Scan(value any) error

Scan implements the Scanner interface.

func (String) Value

func (s String) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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