Documentation
¶
Index ¶
- Variables
- func AddSlashes(str string) string
- func Contains(str, substr string) bool
- func ContainsAny(s, chars string) bool
- func ContainsI(str, substr string) bool
- func IsNumeric(s string) bool
- func Parse(s string) (result map[string]interface{}, err error)
- func PosI(haystack, needle string, startOffset ...int) int
- func QuoteMeta(str string, chars ...string) string
- func Replace(origin, search, replace string, count ...int) string
- func SplitAndTrim(str, delimiter string, characterMask ...string) []string
- func Trim(str string, characterMask ...string) string
- func TrimAll(str string, characterMask ...string) string
- func TrimLeft(str string, characterMask ...string) string
- func TrimLeftStr(str string, cut string, count ...int) string
- func TrimRight(str string, characterMask ...string) string
- func TrimRightStr(str string, cut string, count ...int) string
- func TrimStr(str string, cut string, count ...int) string
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultTrimChars are the characters which are stripped by Trim* functions in default. DefaultTrimChars = string([]byte{ '\t', '\v', '\n', '\r', '\f', ' ', 0x00, 0x85, 0xA0, }) )
Functions ¶
func ContainsAny ¶
ContainsAny reports whether any Unicode code points in <chars> are within <s>.
func Parse ¶
Parse parses the string into map[string]interface{}.
v1=m&v2=n -> map[v1:m v2:n] v[a]=m&v[b]=n -> map[v:map[a:m b:n]] v[a][a]=m&v[a][b]=n -> map[v:map[a:map[a:m b:n]]] v[]=m&v[]=n -> map[v:[m n]] v[a][]=m&v[a][]=n -> map[v:map[a:[m n]]] v[][]=m&v[][]=n -> map[v:[map[]]] // Currently does not support nested slice. v=m&v[a]=n -> error a .[[b=c -> map[a___[b:c]
func PosI ¶
PosI returns the position of the first occurrence of <needle> in <haystack> from <startOffset>, case-insensitively. It returns -1, if not found.
func QuoteMeta ¶
QuoteMeta returns a version of str with a backslash character (\) before every character that is among: .\+*?[^]($)
func Replace ¶
Replace returns a copy of the string `origin` in which string `search` replaced by `replace` case-sensitively.
func SplitAndTrim ¶
SplitAndTrim splits string `str` by a string `delimiter` to an array, and calls Trim to every element of this array. It ignores the elements which are empty after Trim.
func Trim ¶
Trim strips whitespace (or other characters) from the beginning and end of a string. The optional parameter <characterMask> specifies the additional stripped characters.
func TrimLeftStr ¶
TrimLeftStr strips all the given <cut> string from the beginning of a string. Note that it does not strip the whitespaces of its beginning.
func TrimRightStr ¶
TrimRightStr strips all the given <cut> string from the end of a string. Note that it does not strip the whitespaces of its end.
Types ¶
This section is empty.