str

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 1 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cutoff

func Cutoff(maxLen int, val string) string

Cutoff 字符串截取,如果截取了部分,后面自动追加 ...

func Diff

func Diff(itemsA []string, itemsB []string) []string

Diff 提取 itemsA 中包含,但是 itemsB 中不存在的元素

func Distinct

func Distinct(input []string) []string

Distinct remove duplicate elements from array

func Exclude

func Exclude(items []string, excepts ...string) []string

Exclude exclude all items match excepts

func Filter

func Filter(items []string, filter func(item string) bool) []string

Filter 字符串数组过滤

func FilterEmpty

func FilterEmpty(items []string) []string

FilterEmpty 过滤掉字符串数组中的空元素

func HasPrefixes

func HasPrefixes(val string, prefixes []string) bool

HasPrefixes 判断字符串是否以指定的前缀开始

func HasSuffixes

func HasSuffixes(val string, suffixes []string) bool

HasSuffixes 判断字符串是否以指定的后缀结束

func In

func In(val string, items []string) bool

In 判断元素是否在字符串数组中

func InIgnoreCase

func InIgnoreCase(val string, items []string) bool

InIgnoreCase 判断元素是否在字符串数组中

func Map

func Map(items []string, mapper func(item string) string) []string

Map 依次对字符串数组中每一个元素做 mapper 操作

func Union

func Union(itemsA []string, itemsB []string) []string

Union 两个字符串数组合并,去重复

Types

This section is empty.

Jump to

Keyboard shortcuts

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