Documentation ¶
Index ¶
- func AnyOf(x interface{}, any ...interface{}) bool
- func ContainsIgnoreCase(a, b string) bool
- func ContainsWord(s, sep, word string) bool
- func Decode(target interface{}, decodeVars ...interface{}) interface{}
- func EmptyThen(s, then string) string
- func Error(err error) string
- func ExpandRange(f string) []string
- func Fields(s string, count int) []string
- func FieldsFunc(s string, count int, f func(rune) bool) []string
- func FieldsFuncX(s, keepStart, keepEnd string, count int, f func(rune) bool) []string
- func FieldsX(s, keepStart, keepEnd string, count int) []string
- func FirstWord(value string) string
- func Has(str string, predicates ...func(rune) bool) bool
- func HasPrefix(s string, p ...string) bool
- func HasSpaces(str string) bool
- func If(c bool, a, b string) string
- func IndexOf(word string, data ...string) int
- func Join(x ...string) string
- func JoinNonEmpty(sep string, x ...string) string
- func MapOf(arr ...string) map[string]string
- func MapToString(m map[string]string) string
- func NoneOf(x interface{}, any ...interface{}) bool
- func Not(p func(rune) bool) func(rune) bool
- func ParseBool(s string) bool
- func ParseBoolE(s string) (bool, error)
- func ParseDuration(s string) time.Duration
- func ParseDurationE(s string) (time.Duration, error)
- func ParseFloat32(s string) float32
- func ParseFloat32E(s string) (float32, error)
- func ParseFloat64(s string) float64
- func ParseFloat64E(s string) (float64, error)
- func ParseInt(s string) int
- func ParseInt16(s string) int16
- func ParseInt16E(s string) (int16, error)
- func ParseInt32(s string) int32
- func ParseInt32E(s string) (int32, error)
- func ParseInt64(s string) int64
- func ParseInt64E(s string) (int64, error)
- func ParseInt8(s string) int8
- func ParseInt8E(s string) (int8, error)
- func ParseIntE(s string) (int, error)
- func ParseMapString(str string, separator, keyValueSeparator string) map[string]string
- func ParseUint(s string) uint
- func ParseUint16(s string) uint16
- func ParseUint16E(s string) (uint16, error)
- func ParseUint32(s string) uint32
- func ParseUint32E(s string) (uint32, error)
- func ParseUint64(s string) uint64
- func ParseUint64E(s string) (uint64, error)
- func ParseUint8(s string) uint8
- func ParseUint8E(s string) (uint8, error)
- func ParseUintE(s string) (uint, error)
- func PickFirst(s string, _ interface{}) string
- func Repeat(s, sep string, times int) string
- func ReplacePrefix(s, prefix, replace string) string
- func SingleLine(s string) string
- func Split1(s, sep string, trimSpace, ignoreEmpty bool) (s0 string)
- func Split2(s, sep string, trimSpace, ignoreEmpty bool) (s0, s1 string)
- func Split3(s, sep string, trimSpace, ignoreEmpty bool) (s0, s1, s2 string)
- func Split4(s, sep string, trimSpace, ignoreEmpty bool) (s0, s1, s2, s3 string)
- func Split5(s, sep string, trimSpace, ignoreEmpty bool) (s0, s1, s2, s3, s4 string)
- func SplitN(s, sep string, trimSpace, ignoreEmpty bool) []string
- func SplitToMap(s string, kvSep, kkSep string) map[string]string
- func SplitTrim(str, sep string) []string
- func SplitX(s string, separate string, ocs ...OpenClose) []string
- func StringContains(container, item, sep, absolute string) bool
- func Strip(str string, predicates ...func(rune) bool) string
- func StripSpaces(str string) string
- func Tpl(tpl string, vars map[string]interface{}) string
- func TryQuote(s string, chars string) string
- type Expand
- type Expandable
- type OpenClose
- type Part
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(target interface{}, decodeVars ...interface{}) interface{}
Decode acts like oracle decode.
func ExpandRange ¶
ExpandRange expands a string like 1-3 to [1,2,3]
func Fields ¶
Fields splits the string s around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an empty slice if s contains only white space. The count determines the number of substrings to return:
n > 0: at most n substrings; the last substring will be the unsplit remainder. n == 0: the result is nil (zero substrings) n < 0: all substrings
Code are copy from strings.Fields and add count parameter to control the max fields.
func FieldsFunc ¶
FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) and returns an array of slices of s. If all code points in s satisfy f(c) or the string is empty, an empty slice is returned. FieldsFunc makes no guarantees about the order in which it calls f(c). If f does not return consistent results for a given c, FieldsFunc may crash.
func FieldsFuncX ¶
FieldsFuncX splits the string s at each run of Unicode code points c satisfying f(c) and returns an array of slices of s. If all code points in s satisfy f(c) or the string is empty, an empty slice is returned. FieldsFunc makes no guarantees about the order in which it calls f(c). If f does not return consistent results for a given c, FieldsFunc may crash.
func FieldsX ¶
FieldsX splits the string s around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an empty slice if s contains only white space. The count determines the number of substrings to return:
n > 0: at most n substrings; the last substring will be the unsplit remainder. n == 0: the result is nil (zero substrings) n < 0: all substrings
Code are copy from strings.Fields and add count parameter to control the max fields.
func ParseBool ¶
ParseBool returns the boolean value represented by the string. It accepts 1, t, true, y, yes, on with camel case incentive.
func ParseBoolE ¶
ParseBoolE returns the boolean value represented by the string. It accepts 1, t, true, y, yes, on as true with camel case incentive and accepts 0, f false, n, no, off as false with camel case incentive Any other value returns an error.
func ParseMapString ¶
ParseMapString parses str to a map.
func ReplacePrefix ¶
ReplacePrefix replace s that starts with prefix to replace. eg . ReplacePrefix("/abc/efg", "/abc", "#") => #/efg eg . ReplacePrefix("/abc/efg", "/efg", "#") => /abc/efg
func SplitToMap ¶
SplitToMap 将字符串s分割成map,其中key和value之间的间隔符是kvSep, kv和kv之间的分隔符是kkSep
func StringContains ¶
StringContains detects an item contained in container in whole word mode separated by sep but if the absolute is specified and the container == absolute, true should always returned
func StripSpaces ¶
StripSpaces strips all spaces from the string.
Types ¶
type Expand ¶
type Expand struct {
// contains filtered or unexported fields
}
Expand structured a expandable unit.
func (Expand) MakeExpand ¶
MakeExpand makes a expanded string slice of expand.
type Expandable ¶
type Expandable interface { // MakePart returns i'th item. Part(i int) string // Len returns the length of part items. Len() int }
Expandable abstract a thing that can be expanded to parts.