stringsx

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: MIT Imports: 8 Imported by: 4

Documentation

Overview

strings的扩展包,也包括字符串slice和set功能。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Btoi

func Btoi(b bool) int

func CamelToSnake

func CamelToSnake(s string) string

CamelToSnake converts a given string to snake case

func CheckPhone

func CheckPhone(s string) bool

func GetMapValue

func GetMapValue(m map[string]string, key string, caseInsensitive bool) string

returns the value of the map for a certain key. Ignore case when comparing if case insensitive.

func GetNotSpace

func GetNotSpace(s ...string) string

func GetSuffix

func GetSuffix(s string) string

func I64SliceContains

func I64SliceContains(a []int64, s int64) bool

func I64SliceIndexOf

func I64SliceIndexOf(a []int64, s int64) int

func ISliceContains

func ISliceContains(a []int, s int) bool

func ISliceIndexOf

func ISliceIndexOf(a []int, s int) int

func Itob

func Itob(i int) bool

func MapKeyToLower

func MapKeyToLower(m map[string]string)

transforms each item of a map to lowercase.

func RemovePrefix

func RemovePrefix(s, prefix string) string

func RemoveSuffix

func RemoveSuffix(s, suffix string) string

func RemoveSymbol

func RemoveSymbol(s, symbol string) string

func SliceAsSetEqual

func SliceAsSetEqual(a1 []string, a2 []string) bool

func SliceClone

func SliceClone(a []string) []string

func SliceContains

func SliceContains(a []string, s string) bool

func SliceContainsCase

func SliceContainsCase(a []string, s string, caseInsensitive bool) bool

func SliceEqual

func SliceEqual(a1 []string, a2 []string) bool

func SliceFilter

func SliceFilter(a []string, target []string, filter func(s string) bool) []string

func SliceFlatten

func SliceFlatten(al ...[]string) []string

func SliceIndexOf

func SliceIndexOf(a []string, s string) int

func SliceInt64Unique

func SliceInt64Unique(a []int64) []int64

func SliceMap

func SliceMap(a []string, f func(s string) string) []string

func SliceRemoveIndex

func SliceRemoveIndex(s []string, index int) []string

func SliceToLower

func SliceToLower(a []string)

transforms each item of a slice to lowercase.

func SliceUnique

func SliceUnique(a []string) []string

func SnakeToCamel

func SnakeToCamel(s string) string

SnakeToCamel returns a string converted from snake case to uppercase

func Strtof

func Strtof(s string) float64

func Strtoi

func Strtoi(s string) int

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

func SetOf

func SetOf(elems ...string) Set

func (*Set) Add

func (set *Set) Add(elems ...string)

func (*Set) Del

func (set *Set) Del(elems ...string)

func (*Set) Each

func (set *Set) Each(f func(elem string))

func (*Set) Elems

func (set *Set) Elems() []string

func (*Set) Has

func (set *Set) Has(elem string) bool

func (*Set) HasAll

func (set *Set) HasAll(elems ...string) bool

func (*Set) HasOne

func (set *Set) HasOne(elems ...string) bool

func (*Set) Size

func (set *Set) Size() int

func (Set) String

func (set Set) String() string

func (*Set) Union

func (set *Set) Union(others ...Set)

Jump to

Keyboard shortcuts

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