strings

package
v0.0.131 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.

*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyString added in v0.0.124

func EmptyString(str string) bool

func EqualCaseInsensitive added in v0.0.117

func EqualCaseInsensitive(src, dst string) bool

func GetStringOrFallback

func GetStringOrFallback(values ...string) string

func RemoveEmpty added in v0.0.52

func RemoveEmpty(s []string) []string

func Replace added in v0.0.53

func Replace(s string, old string, news []interface{}, useQuote bool, n int) string

func ReplaceAll added in v0.0.53

func ReplaceAll(s, old string, news []interface{}, useQuote bool) string

func SliceContains added in v0.0.61

func SliceContains(list []string, target string, caseSensitive bool) bool

func SliceContainsCaseInSensitive added in v0.0.75

func SliceContainsCaseInSensitive(list []string, target string) bool

sliceContains reports whether the provided string is present in the given slice of strings.

func SliceDifference added in v0.0.91

func SliceDifference(s1 []string, s2 []string) []string

func SliceIntersection added in v0.0.29

func SliceIntersection(s1 []string, s2 []string) []string

func SliceUnique added in v0.0.29

func SliceUnique(s ...string) []string

func SliceWithCondition added in v0.0.99

func SliceWithCondition(s1 []string, cond func(s2 string) bool) []string

func Split2 added in v0.0.93

func Split2(s, sep string) (string, string, bool)

Split2 returns the values from strings.SplitN(s, sep, 2). If sep is not found, it returns ("", "", false) instead.

func SplitOmitEmpty added in v0.0.80

func SplitOmitEmpty(s, sep string) []string

Split slices s into all substrings separated by sep and returns a slice of the substrings between those separators.

If s does not contain sep and sep is not empty, Split returns a slice of length 0.

If sep is empty, Split splits after each UTF-8 sequence. If both s and sep are empty, Split returns an empty slice.

It is equivalent to SplitN with a count of -1.

func SplitToNums added in v0.0.100

func SplitToNums[T any](s, sep string, convert func(string) (T, error)) ([]T, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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