str

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Helper functions for handling strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanUp added in v0.13.0

func CleanUp(str string) string

func Contains

func Contains(slice []string, s string) bool

Checks if given string exists in the slice.

func ContainsIgnorecase

func ContainsIgnorecase(slice []string, s string) bool

Checks if given string exists in the slice. Case insensitive.

func FindIndex

func FindIndex(slice []string, s string) (int, bool)

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 Insert added in v0.2.3

func Insert(slice []string, idx int, val string) []string

Inserts given string to given index into a slice.

func Remove added in v0.2.3

func Remove(slice []string, s string) []string

Removes the first occurence of given string from a slice.

func RemoveFrom added in v0.2.3

func RemoveFrom(slice []string, s int) []string

Removes a string from given index.

func Select added in v0.21.1

func Select(condition bool, i1, i2 string) string

Returns i1 if condition == TRUE, else returns i2

func SwitchIf added in v0.21.0

func SwitchIf(condition bool, i1, i2 string) (string, string)

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

func ToSnakeCase(str string) string

Converts string to SnakeCase.

func Unique

func Unique(t []string) []string

Returns unique strings from given slice of strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL