Documentation
¶
Index ¶
- Constants
- func Pos(haystack, needle string, startOffset ...int) int
- func PosI(haystack, needle string, startOffset ...int) int
- func PosIRune(haystack, needle string, startOffset ...int) int
- func PosR(haystack, needle string, startOffset ...int) int
- func PosRI(haystack, needle string, startOffset ...int) int
- func PosRIRune(haystack, needle string, startOffset ...int) int
- func PosRRune(haystack, needle string, startOffset ...int) int
- func PosRune(haystack, needle string, startOffset ...int) int
- func QuoteMeta(str string, chars ...string) string
- func Replace(origin, search, replace string, count ...int) string
- func ReplaceByArray(origin string, array []string) string
- func ReplaceByMap(origin string, replaces map[string]string) string
- func ReplaceI(origin, search, replace string, count ...int) string
- func ReplaceIByArray(origin string, array []string) string
- func ReplaceIByMap(origin string, replaces map[string]string) string
Constants ¶
const (
// NotFoundIndex is the position index for string not found in searching functions.
NotFoundIndex = -1
)
Variables ¶
This section is empty.
Functions ¶
func Pos ¶
Pos returns the position of the first occurrence of `needle` in `haystack` from `startOffset`, case-sensitively. It returns -1, if not found.
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 PosIRune ¶
PosIRune acts like function PosI but considers `haystack` and `needle` as unicode string.
func PosR ¶
PosR returns the position of the last occurrence of `needle` in `haystack` from `startOffset`, case-sensitively. It returns -1, if not found.
func PosRI ¶
PosRI returns the position of the last occurrence of `needle` in `haystack` from `startOffset`, case-insensitively. It returns -1, if not found.
func PosRIRune ¶
PosRIRune acts like function PosRI but considers `haystack` and `needle` as unicode string.
func PosRRune ¶
PosRRune acts like function PosR but considers `haystack` and `needle` as unicode string.
func PosRune ¶
PosRune acts like function Pos but considers `haystack` and `needle` as unicode string.
func QuoteMeta ¶
QuoteMeta returns a version of `str` with a backslash character (`\`). If custom chars `chars` not given, it uses default chars: .\+*?[^]($)
func Replace ¶
Replace returns a copy of the string `origin` in which string `search` replaced by `replace` case-sensitively.
func ReplaceByArray ¶
ReplaceByArray returns a copy of `origin`, which is replaced by a slice in order, case-sensitively.
func ReplaceByMap ¶
ReplaceByMap returns a copy of `origin`, which is replaced by a map in unordered way, case-sensitively.
func ReplaceI ¶
ReplaceI returns a copy of the string `origin` in which string `search` replaced by `replace` case-insensitively.
func ReplaceIByArray ¶
ReplaceIByArray returns a copy of `origin`, which is replaced by a slice in order, case-insensitively.
Types ¶
This section is empty.