xstring

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 1 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BLeft

func BLeft(s string, l int) string

func BRight

func BRight(s string, l int) string

func Camel2UnderScore

func Camel2UnderScore(s string, score string) string

func Contain

func Contain(s, sub string) bool

func EndWith

func EndWith(s string, search string) bool

是否包含后缀

func FirstCharLowerCase

func FirstCharLowerCase(s string) string

func FirstCharUpperCase

func FirstCharUpperCase(s string) string

func Foreach

func Foreach(s string, fn func(i int, s string) bool)

func IndexOf

func IndexOf(s, sub string) int

func IsFirstLetterLower

func IsFirstLetterLower(s string) bool

func IsFirstLetterUpper

func IsFirstLetterUpper(s string) bool

func IsLetterLower

func IsLetterLower(b byte) bool

检查节字是否是小写字线

func IsLetterUpper

func IsLetterUpper(b byte) bool

检查字节是否是大写字母

func IsNumeric

func IsNumeric(s string) bool

检查字符串是否是纯数字

func Join

func Join(items []string, sep string) string

func LastIndexOf

func LastIndexOf(s, sub string) int

func LcFirst

func LcFirst(s string) string

将字符串首字母转换成小写

func Left

func Left(s string, l int) string

func Len

func Len(s string) int

func LowerCase

func LowerCase(s string) string

转换成小写

func MakeAndFillStrSlice

func MakeAndFillStrSlice(size int, fillChar string) []string

func MakeStrAndFill

func MakeStrAndFill(count int, repeatChar string, sep string) string

func MuSplit

func MuSplit(s string, sep uint8, more ...uint8) []string

func ParseKeyValue

func ParseKeyValue(s string) map[string]string

解析键值对字符串为hashMap 格式:

1、键1:值1;键2:值2
2、键1:值1,键2:值2
3、键1=值1&键2=值2
4、键1=值1;键2=值2
4、键1=值1,键2=值2

func Replace

func Replace(origin, search, replace string, count ...int) string

func ReplaceByMap

func ReplaceByMap(origin string, replaces map[string]string) string

替换字符串

func Right(s string, l int) string

func Split

func Split(s, sep string, needCount ...int) []string

func Splits

func Splits(s, sep string, more ...string) []string

func StartWith

func StartWith(s string, search string) bool

是否包含前缀

func SubStr

func SubStr(s string, fromIdx int, slen ...int) string

func Trim

func Trim(s string) string

func UcFirst

func UcFirst(s string) string

将字符串首字母转换成大写

func UnderScore2Camel

func UnderScore2Camel(s string, score string) string

func UpperCase

func UpperCase(s string) string

转换在大写

Types

type String

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

func New

func New(s ...string) *String

func (*String) BForeach

func (s *String) BForeach(fn func(i int, c uint8) bool)

func (*String) BLeft

func (s *String) BLeft(l int) string

func (*String) BLeftO

func (s *String) BLeftO(l int) *String

func (*String) BLen

func (s *String) BLen() int

func (*String) BRight

func (s *String) BRight(l int) string

func (*String) BRightO

func (s *String) BRightO(l int) *String

func (*String) Camel2UnderScore

func (s *String) Camel2UnderScore(score string) *String

func (*String) Camel2UnderScoreStr

func (s *String) Camel2UnderScoreStr(score string) string

func (*String) CamelCase

func (s *String) CamelCase() *String

func (*String) CamelCaseStr

func (s *String) CamelCaseStr() string

func (*String) Cat

func (s *String) Cat(other *String) *String

func (*String) CatStr

func (s *String) CatStr(other string) *String

func (*String) Clone

func (s *String) Clone() *String

func (*String) Contain

func (s *String) Contain(sub string) bool

func (*String) Contains

func (s *String) Contains(substr string) bool

func (*String) Equal

func (s *String) Equal(target *String) bool

func (*String) EqualStr

func (s *String) EqualStr(target string) bool

func (*String) FirstLowerCase

func (s *String) FirstLowerCase() *String

func (*String) FirstLowerCaseStr

func (s *String) FirstLowerCaseStr() string

func (*String) FirstUpperCase

func (s *String) FirstUpperCase() *String

func (*String) FirstUpperCaseStr

func (s *String) FirstUpperCaseStr() string

func (*String) Foreach

func (s *String) Foreach(fn func(i int, c string) bool)

func (*String) IndexOf

func (s *String) IndexOf(sub string) int

func (*String) IsEmpty

func (s *String) IsEmpty() bool

func (*String) IsLowerFirst

func (s *String) IsLowerFirst() bool

首字母是否是小写

func (*String) IsNumeric

func (s *String) IsNumeric() bool

字符串是否是数字

func (*String) IsUpperFirst

func (s *String) IsUpperFirst() bool

首字母是否是大写

func (*String) Join

func (s *String) Join(elems []string, sep string) *String

func (*String) JoinStr

func (s *String) JoinStr(elems []string, sep string) string

func (*String) LastIndexOf

func (s *String) LastIndexOf(sub string) int

func (*String) LcFirst

func (s *String) LcFirst() *String

首字母转成小写

func (*String) Left

func (s *String) Left(l int) string

func (*String) LeftO

func (s *String) LeftO(l int) *String

func (*String) Len

func (s *String) Len() int

func (*String) LowerUnderScore

func (s *String) LowerUnderScore() *String

func (*String) LowerUnderScoreStr

func (s *String) LowerUnderScoreStr() string

func (*String) Replace

func (s *String) Replace(search, replace string, count ...int) *String

func (*String) ReplaceByMap

func (s *String) ReplaceByMap(replaces map[string]string) *String

func (*String) ReplaceByMapStr

func (s *String) ReplaceByMapStr(replaces map[string]string) string

func (*String) ReplaceStr

func (s *String) ReplaceStr(search, replace string, count ...int) string

func (*String) Right

func (s *String) Right(l int) string

func (*String) RightO

func (s *String) RightO(l int) *String

func (*String) Set

func (s *String) Set(val string) *String

func (*String) Split

func (s *String) Split(sep string) []*String

func (*String) SplitStr

func (s *String) SplitStr(sep string) []string

func (*String) String

func (s *String) String() string

func (*String) SubStr

func (s *String) SubStr(fromIdx int, l int) string

获取子字符串 @fromIndex >=0 从左边取l长度的字符串,< 0 从右边取l长度的字符串 @l 字符串长度

func (*String) SubStrO

func (s *String) SubStrO(fromIdx int, l int) *String

func (*String) ToLower

func (s *String) ToLower() *String

func (*String) ToUpper

func (s *String) ToUpper() *String

func (*String) Trim

func (s *String) Trim() *String

func (*String) UcFirst

func (s *String) UcFirst() *String

首字母转成大写

func (*String) UnderScore2Camel

func (s *String) UnderScore2Camel(score string) *String

func (*String) UnderScore2CamelStr

func (s *String) UnderScore2CamelStr(score string) string

func (*String) UpperUnderScore

func (s *String) UpperUnderScore() *String

func (*String) UpperUnderScoreStr

func (s *String) UpperUnderScoreStr() string

Jump to

Keyboard shortcuts

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