Documentation
¶
Index ¶
- func Find(needle string, haystack []string) int
- func FindCust(needle string, haystack []string, custCompare func(string, string) bool) int
- func MatchingProblem(obj, i1, i2 interface{}) string
- func ReplaceAnyBetween(s, start, end, old, new string) string
- func ReplaceFuncBetween(s, start, end string, rpl ReplaceFunc) string
- func SetIfExists(dst *string, src string)
- func StringBetween(s, start, end string) (found bool, str string)
- func ToCamel(s string, sep rune, capitalize bool) string
- func ToSnake(s string) string
- type ReplaceFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
Find returns the index of the needle in the haystack (has to match exactly) or returns -1 if the needles wasn't found
func FindCust ¶
FindCust returns the idnex of the needle in the haystack (has to match according to the custCompare function) or returns -1 if the needles wasn't found
func MatchingProblem ¶
func MatchingProblem(obj, i1, i2 interface{}) string
MatchingProblem returns a formatted string which explains that the two elements s1 and s2 of type obj don't match
func ReplaceAnyBetween ¶
ReplaceAnyBetween replaces in s only 'old' between start and end for 'new' e.g. "asdf{{hehe}}ff" -(start:}},end:}},old:ha,new:ho)-> "asdf{{hoho}}ff"
func ReplaceFuncBetween ¶
func ReplaceFuncBetween(s, start, end string, rpl ReplaceFunc) string
ReplaceFuncBetween is similar to ReplaceAnyBetween. It looks through the string, and replaces the string between start and end with the ReplaceFunc.
func SetIfExists ¶
SetIfExists does dst = src (only if src is not empty)
func StringBetween ¶
StringBetween returns a string enclosed by start and end (excluded both)
Types ¶
type ReplaceFunc ¶
ReplaceFunc is the type of a function which takes a string and replaces what it wants, then returns it