Documentation ¶
Overview ¶
Helper functions for handling strings.
Index ¶
- func CleanUp(str string) string
- func Contains(slice []string, s string) bool
- func ContainsIgnorecase(slice []string, s string) bool
- func FindIndex(slice []string, s string) (int, bool)
- func GetIndex(slice []string, s string) int
- func GetIndexIgnoreCase(slice []string, s string) int
- func GetString(path, env string) (response string, err error)
- func Insert(slice []string, idx int, val string) []string
- func Remove(slice []string, s string) []string
- func RemoveFrom(slice []string, s int) []string
- func ReplaceNil(s string, t *string) string
- func Select(condition bool, i1, i2 string) string
- func SwitchIf(condition bool, i1, i2 string) (string, string)
- func ToSnakeCase(str string) string
- func Unique(t []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsIgnorecase ¶
ContainsIgnorecase Checks if given string exists in the slice. Case insensitive.
func FindIndex ¶
FindIndex Finds the index of first occurrence of the given value and returns the index and a boolean. Boolean is true when index is found, otherwise index = -1.
func GetIndex ¶ added in v0.24.0
GetIndex Finds the index of first occurrence of the given string and returns the index. If not found index = -1.
func GetIndexIgnoreCase ¶ added in v0.24.0
GetIndexIgnoreCase Finds the index of first occurrence of the given string while ignoring the case and returns the index. If not found index = -1.
func RemoveFrom ¶ added in v0.2.3
RemoveFrom Removes a string from given index.
func ReplaceNil ¶ added in v0.24.2
Replaces nil valued *string with given string
func SwitchIf ¶ added in v0.21.0
Returns the given values without changes, if condition == FALSE. Returns the values in switched order, if condition == TRUE.
func ToSnakeCase ¶ added in v0.2.3
Converts string to SnakeCase.
Types ¶
This section is empty.