Documentation ¶
Index ¶
- func DictToJSON(dict string) string
- func GetDefaultString(str, def string) string
- func HumanSize(size int64) string
- func IsIn(str string, lst ...string) bool
- func MakeUnique(str string, pool []string) string
- func MarshalToJSONString(data interface{}) string
- func SnakeCase(in string) string
- func StartsAndEndsWith(str, prefix, suffix string) bool
- func Substitute(str string, mapping map[string]string) string
- func Title(in string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DictToJSON ¶
DictToJSON sanitizes a python dict string representation to valid JSON.
func GetDefaultString ¶
GetDefaultString returns str if it is not an empty string or def otherwise
func IsIn ¶ added in v0.0.6
IsIn returns true if the given str is the same as one of the strings given in lst
func MakeUnique ¶
MakeUnique returns an unique string in reference of the given pool its made of the base string plus a number if it exists within the pool
func MarshalToJSONString ¶
func MarshalToJSONString(data interface{}) string
MarshalToJSONString marshals the given data to its JSON representation and returns it as a string. It panics in case of error.
func SnakeCase ¶
SnakeCase convert the given string to snake case following the Golang format: acronyms are converted to lower-case and preceded by an underscore.
func StartsAndEndsWith ¶
StartsAndEndsWith returns true if the given string starts with prefix and ends with suffix.
func Substitute ¶
Substitute substitutes each occurrence of each key of mapping in str by the corresponding mapping value and returns the substituted string.
Types ¶
This section is empty.