extstr

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSlashes

func AddSlashes(s string) string

AddSlashes returns a string with backslashes added before characters that need to be escaped. 使用反斜线引用字符串,对' " \转义.

func Append

func Append(strs []string, str string) []string

Append appends string to slice with no duplicates. 追加字符串,无重复项

func CamelCase

func CamelCase(str string) string

CamelCase to camel case string id_com -> IDCom idcom -> Idcom name_id_com -> NameIDCom name_idcom -> NameIdcom

func Compare

func Compare(s1, s2 []string) bool

Compare compares two 'string' type slices. It returns true if elements and order are both the same. 比较两个字符串切片,要求元素和顺序都一致才返回true

func CompareU

func CompareU(s1, s2 []string) bool

CompareU compares two 'string' type slices. It returns true if elements are the same, and ignores the order. 比较两个字符串切片,要求元素一致,且忽略顺序,一致返回true

func Contains

func Contains(sl []string, str string) bool

Contains returns true if the string exists in given slice 字符串切片是否含有指定的元素,大小写敏感

func ContainsFold

func ContainsFold(sl []string, str string) bool

ContainsFold returns true if the string exists in given slice, ignore case. 字符串切片是否含有指定的元素,忽略大小写

func Delete

func Delete(s []string, e string) []string

Delete 删除string切片中的,第一个出现的指定元素

func DeleteAll

func DeleteAll(s []string, e string) []string

DeleteAll 删除string切片中的 所有出现的指示元素

func HasChinese

func HasChinese(str string) bool

HasChinese 字符串是否含有中文.

func HasLetter

func HasLetter(str string) bool

HasLetter 字符串是否含有(英文)字母.

func HasSpecialChar

func HasSpecialChar(str string) bool

HasSpecialChar 标点字符,符号字符, mark 字符

func IsASCII

func IsASCII(str string) bool

IsASCII 是否IsASCII字符串.

func IsGoInternalType added in v0.0.5

func IsGoInternalType(t string) bool

IsGoInternalType 是否是Golang内部类型

func IsGoKeywords added in v0.0.5

func IsGoKeywords(t string) bool

IsGoKeywords 是否是Golang关键字

func IsLetter

func IsLetter(r rune) bool

IsLetter 是否是英文字母

func IsLetters

func IsLetters(str string) bool

IsLetters 字符串是否全英文字母

func Join

func Join(elems []int64, sep string) string

Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

func JoinInt

func JoinInt(elems []int, sep string) string

JoinInt concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

func Kebab

func Kebab(str string) string

Kebab 转换驼峰字符串为用'-'分隔的字符串,特殊字符由DefaultInitialisms决定取代 example2: delimiter = '-' initialisms = DefaultInitialisms IDCom -> id-com IDcom -> idcom nameIDCom -> name-id-com nameIDcom -> name-idcom

func LowTitle

func LowTitle(s string) string

LowTitle 首字母小写 see strings.Title

func Map added in v0.0.2

func Map(ss []string, mapping func(string) string) []string

Map 本地修改原ss

func Mapx added in v0.0.2

func Mapx(ss []string, mapping func(string) string) []string

Mapx 新建新的,并执行map

func QuoteMeta

func QuoteMeta(s string) string

QuoteMeta returns a version of str with a backslash character (\) before every character that is among these: . \ + * ? [ ^ ] ( $ ) 转义元字符集,包括 . + \ ( $ ) [ ^ ] * ?

func Recombine

func Recombine(str string, delimiter byte) string

Recombine 转换驼峰字符串为用delimiter分隔的字符串, 特殊字符由DefaultInitialisms决定取代 example: delimiter = '_' 空字符 -> 空字符 HelloWorld -> hello_world Hello_World -> hello_world HiHello_World -> hi_hello_world IDCom -> id_com IDcom -> idcom nameIDCom -> name_id_com nameIDcom -> name_idcom

func Reverse

func Reverse(n int, f func(from, to int))

Reverse reverse a slice

func ReverseString added in v0.0.3

func ReverseString(s string) string

Reverse a utf8 encoded string.

func Shuffle

func Shuffle(str string) string

Shuffle pseudo-randomizes the order of elements using the default Source.

func SmallCamelCase added in v0.0.5

func SmallCamelCase(fieldName string) string

SmallCamelCase to small camel case string id_com -> idCom idcom -> idcom name_id_com -> nameIDCom name_idcom -> nameIdcom

func SnakeCase

func SnakeCase(str string) string

SnakeCase 转换驼峰字符串为用'_'分隔的字符串,特殊字符由DefaultInitialisms决定取代 example2: delimiter = '_' initialisms = DefaultInitialisms IDCom -> id_com IDcom -> idcom nameIDCom -> name_id_com nameIDcom -> name_idcom

func Split

func Split(s, sep string) []int64

Split Split slices s into all substrings separated by sep and returns a slice of the int64 between those separators.

func SplitInt

func SplitInt(s, sep string) []int

SplitInt Split slices s into all substrings separated by sep and returns a slice of the int between those separators.

func StripSlashes

func StripSlashes(s string) string

StripSlashes returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\). 使用反斜线反引用字符串,对 \' \" \\反转义.

func UnRecombine

func UnRecombine(str string, delimiter byte) string

UnRecombine 转换sep分隔的字符串为驼峰字符串 example: delimiter = '_' 空字符 -> 空字符 hello_world -> HelloWorld

func Unique

func Unique(a []string) []string

Unique takes an input slice of strings and returns a new slice of strings without duplicate values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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