cp

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendIfMissing added in v1.2.0

func AppendIfMissing(str string, suffix string, suffixes ...string) string

AppendIfMissing appends a suffix to a string if missing.

func AppendIfMissingIgnoreCase added in v1.2.0

func AppendIfMissingIgnoreCase(str string, suffix string, suffixes ...string) string

AppendIfMissingIgnoreCase appends a suffix to a string if missing (ignoring case).

func AsList added in v1.2.1

func AsList(a ...string) []string

func AsListDouble added in v1.3.0

func AsListDouble(a ...float64) []float64

func AsListInt added in v1.3.0

func AsListInt(a ...int) []int

func AsListLong added in v1.3.0

func AsListLong(a ...int64) []int64

func CheckError

func CheckError(err error)

func Chomp added in v1.2.0

func Chomp(str string) string

Chomp removes one newline from end of a string if it's there, otherwise leave it alone. A newline is "\n", "\r", or "\r\n".

func Contains added in v1.2.0

func Contains(str string, search string) bool

Contains checks if string contains a search string.

func ContainsAny added in v1.2.0

func ContainsAny(str string, search ...string) bool

ContainsAny checks if the string contains any of the string in the given array.

func ContainsAnyCharacter added in v1.2.0

func ContainsAnyCharacter(str string, search string) bool

ContainsAnyCharacter checks if the string contains any of the character in the given string.

func ContainsIgnoreCase added in v1.2.0

func ContainsIgnoreCase(str string, search string) bool

ContainsIgnoreCase checks if the string contains the searched string ignoring case.

func ContainsNone added in v1.2.0

func ContainsNone(str string, search ...string) bool

ContainsNone checks if the string contains no occurrence of searched string.

func ContainsNoneCharacter added in v1.2.0

func ContainsNoneCharacter(str string, search string) bool

ContainsNoneCharacter checks if the string contains no occurrence of searched string.

func ContainsOnly added in v1.2.0

func ContainsOnly(str string, search ...string) bool

ContainsOnly checks if a string contains only some strings.

func DefaultIfBlank added in v1.2.0

func DefaultIfBlank(str string, defaultStr string) string

DefaultIfBlank returns either the passed in String, or if the String is Blank, the value of defaultStr.

func DefaultIfEmpty added in v1.2.0

func DefaultIfEmpty(str string, defaultStr string) string

DefaultIfEmpty returns either the passed in String, or if the String is Empty, the value of defaultStr.

func EndsWith added in v1.2.0

func EndsWith(str string, suffix string) bool

EndsWith check if a string ends with a specified suffix.

func EndsWithAny added in v1.2.0

func EndsWithAny(str string, suffixes ...string) bool

EndsWithAny check if a string ends with any of an array of specified strings.

func EndsWithAnyIgnoreCase added in v1.2.0

func EndsWithAnyIgnoreCase(str string, suffixes ...string) bool

EndsWithAnyIgnoreCase check if a string ends with any of an array of specified strings (ignoring case).

func EndsWithIgnoreCase added in v1.2.0

func EndsWithIgnoreCase(str string, suffix string) bool

EndsWithIgnoreCase case in sensitive check if a string ends with a specified suffix.

func Find added in v1.2.0

func Find[T cmp.Ordered](list []T, value T) int

func FindAll added in v1.2.0

func FindAll[T cmp.Ordered](list []T, value T) []int

func FindLast added in v1.2.0

func FindLast[T cmp.Ordered](list []T, value T) int

func FormatDouble added in v1.0.5

func FormatDouble[T DecimalNumber](f T) string

func FormatInt added in v1.0.5

func FormatInt[T IntegerNumber](i T) string

func Frequencies added in v1.0.9

func Frequencies[T cmp.Ordered](list []T, sortKeys bool) (map[T]int, []T)

func GCD added in v1.2.0

func GCD[T IntegerNumber](a, b T) T

func IsAllLowerCase added in v1.2.0

func IsAllLowerCase(str string) bool

IsAllLowerCase checks if the string contains only lowercase characters.

func IsAllUpperCase added in v1.2.0

func IsAllUpperCase(str string) bool

IsAllUpperCase checks if the string contains only uppercase characters.

func IsAlpha added in v1.2.0

func IsAlpha(str string) bool

IsAlpha checks if the string contains only Unicode letters.

func IsAlphaSpace added in v1.2.0

func IsAlphaSpace(str string) bool

IsAlphaSpace checks if the string contains only Unicode letters and spaces.

func IsAlphanumeric added in v1.2.0

func IsAlphanumeric(str string) bool

IsAlphanumeric checks if the string contains only Unicode letters and digits.

func IsAlphanumericSpace added in v1.2.0

func IsAlphanumericSpace(str string) bool

IsAlphanumericSpace checks if the string contains only Unicode letters, digits and spaces.

func IsAnyBlank added in v1.2.0

func IsAnyBlank(strings ...string) bool

IsAnyBlank checks if any one of the strings are empty or containing only whitespaces.

func IsAnyEmpty added in v1.2.0

func IsAnyEmpty(strings ...string) bool

IsAnyEmpty checks if any one of the given strings are empty.

func IsBlank added in v1.2.0

func IsBlank(s string) bool

IsBlank checks if a string is whitespace or empty

func IsEmpty added in v1.2.0

func IsEmpty(s string) bool

IsEmpty checks if a string is empty.

func IsNoneBlank added in v1.2.0

func IsNoneBlank(strings ...string) bool

IsNoneBlank checks if none of the strings are empty or containing only whitespaces.

func IsNoneEmpty added in v1.2.0

func IsNoneEmpty(strings ...string) bool

IsNoneEmpty checks if none of the strings are empty.

func IsNotBlank added in v1.2.0

func IsNotBlank(s string) bool

IsNotBlank checks if a string is not empty or containing only whitespaces.

func IsNotEmpty added in v1.2.0

func IsNotEmpty(s string) bool

IsNotEmpty checks if a string is not empty.

func IsNumeric added in v1.2.0

func IsNumeric(str string) bool

IsNumeric checks if the string contains only digits.

func IsNumericSpace added in v1.2.0

func IsNumericSpace(str string) bool

IsNumericSpace checks if the string contains only digits and whitespace.

func IsWhitespace added in v1.2.0

func IsWhitespace(str string) bool

IsWhitespace checks if the string contains only whitespace.

func LCM added in v1.2.0

func LCM[T IntegerNumber](a, b T) T

func Left added in v1.2.0

func Left(str string, size int) string

Left gets the leftmost len characters of a string.

func LowerCase added in v1.2.0

func LowerCase(str string) string

LowerCase converts a string to lower case.

func MaxDouble added in v1.0.2

func MaxDouble(list []float64) (float64, int)

func MaxInt

func MaxInt(list []int) (int, int)

func MaxLong

func MaxLong(list []int64) (int64, int)

func Mid added in v1.2.0

func Mid(str string, pos int, size int) string

Mid gets size characters from the middle of a string.

func MinDouble added in v1.0.4

func MinDouble(list []float64) (float64, int)

func MinInt

func MinInt(list []int) (int, int)

func MinLong

func MinLong(list []int64) (int64, int)

func Overlay added in v1.2.0

func Overlay(str string, overlay string, start int, end int) string

Overlay overlays part of a string with another string.

func ParseDouble

func ParseDouble(s string) float64

func ParseInt

func ParseInt(s string) int

func ParseLong

func ParseLong(s string) int64

func PrependIfMissing added in v1.2.0

func PrependIfMissing(str string, prefix string, prefixes ...string) string

PrependIfMissing prepends the prefix to the start of the string if the string does not already start with any of the prefixes.

func PrependIfMissingIgnoreCase added in v1.2.0

func PrependIfMissingIgnoreCase(str string, prefix string, prefixes ...string) string

PrependIfMissingIgnoreCase prepends the prefix to the start of the string if the string does not already start, case-in sensitive, with any of the prefixes.

func ReadFile

func ReadFile(filePath string) string

func Remove added in v1.2.0

func Remove(str string, remove string) string

Remove removes all occurrences of a substring from within the source string.

func RemoveEnd added in v1.2.0

func RemoveEnd(str string, remove string) string

RemoveEnd removes a substring only if it is at the end of a source string, otherwise returns the source string.

func RemoveEndIgnoreCase added in v1.2.0

func RemoveEndIgnoreCase(str string, remove string) string

RemoveEndIgnoreCase is the case in sensitive removal of a substring if it is at the end of a source string, otherwise returns the source string.

func RemovePattern added in v1.2.0

func RemovePattern(str string, pattern string) string

RemovePattern removes each substring of the source string that matches the given regular expression

func RemoveStart added in v1.2.0

func RemoveStart(str string, remove string) string

RemoveStart removes a substring only if it is at the beginning of a source string, otherwise returns the source string

func RemoveStartIgnoreCase added in v1.2.0

func RemoveStartIgnoreCase(str string, remove string) string

RemoveStartIgnoreCase is the case in sensitive removal of a substring if it is at the beginning of a source string, otherwise returns the source string.

func Repeat added in v1.2.0

func Repeat(str string, repeat int) string

Repeat repeats a string `repeat` times to form a new string.

func RepeatWithSeparator added in v1.2.0

func RepeatWithSeparator(str string, sep string, repeat int) string

RepeatWithSeparator repeats a string `repeat` times to form a new String, with a string separator injected each time.

func Reverse added in v1.2.0

func Reverse(s string) string

Reverse reverses a string.

func ReverseDelimited added in v1.2.0

func ReverseDelimited(str string, del string) string

ReverseDelimited reverses a string separated by a delimiter.

func Right(str string, size int) string

Right gets the rightmost len characters of a string.

func RunAdventOfCodeWithFile added in v1.0.6

func RunAdventOfCodeWithFile(funcToRun func([]string), filePath string)

func RunAdventOfCodeWithString added in v1.0.6

func RunAdventOfCodeWithString(funcToRun func([]string), stringInput string)

func RunHackerRank added in v1.0.2

func RunHackerRank(funcToRun func([]string, *bufio.Writer))

func RunWithFile added in v1.0.2

func RunWithFile(funcToRun func([]string, *bufio.Writer), filePath string)

func RunWithString added in v1.0.2

func RunWithString(funcToRun func([]string, *bufio.Writer), stringInput string)

func Split

func Split(line string, separator string) []string

func SplitDoubles

func SplitDoubles(line string, separator string) []float64

func SplitGetAt added in v1.0.9

func SplitGetAt(line string, separator string, index int) string

func SplitGetDoubleAt added in v1.2.0

func SplitGetDoubleAt(line string, separator string, index int) float64

func SplitGetIntAt added in v1.2.0

func SplitGetIntAt(line string, separator string, index int) int

func SplitGetLongAt added in v1.2.0

func SplitGetLongAt(line string, separator string, index int) int64

func SplitInts

func SplitInts(line string, separator string) []int

func SplitLongs

func SplitLongs(line string, separator string) []int64

func StartsWith added in v1.2.0

func StartsWith(str string, prefix string) bool

StartsWith check if a string starts with a specified prefix.

func StartsWithAny added in v1.2.0

func StartsWithAny(str string, prefixes ...string) bool

StartsWithAny check if a string starts with any of an array of specified strings.

func StartsWithAnyIgnoreCase added in v1.2.0

func StartsWithAnyIgnoreCase(str string, prefixes ...string) bool

StartsWithAnyIgnoreCase check if a string starts with any of an array of specified strings (ignoring case).

func StartsWithIgnoreCase added in v1.2.0

func StartsWithIgnoreCase(str string, prefix string) bool

StartsWithIgnoreCase case in sensitive check if a string starts with a specified prefix.

func Strip added in v1.2.0

func Strip(str string) string

Strip strips whitespace from the start and end of a String.

func StripEnd added in v1.2.0

func StripEnd(str string) string

StripEnd strips whitespace from the end of a String.

func StripStart added in v1.2.0

func StripStart(str string) string

StripStart strips whitespace from the start of a String.

func SubstringAfter added in v1.2.0

func SubstringAfter(str string, sep string) string

SubstringAfter gets the substring after the first occurrence of a separator.

func SubstringAfterLast added in v1.2.0

func SubstringAfterLast(str string, sep string) string

SubstringAfterLast gets the substring after the last occurrence of a separator.

func SubstringBefore added in v1.2.0

func SubstringBefore(str string, sep string) string

SubstringBefore gets the substring before the first occurrence of a separator.

func SubstringBeforeLast added in v1.2.0

func SubstringBeforeLast(str string, sep string) string

SubstringBeforeLast gets the substring before the last occurrence of a separator.

func Trim added in v1.0.7

func Trim(str string) string

Trim removes control characters from both ends of this string.

func UpperCase added in v1.2.0

func UpperCase(str string) string

UpperCase converts a string to upper case.

Types

type DecimalNumber added in v1.2.0

type DecimalNumber interface {
	~float32 | ~float64
}

type IntegerNumber added in v1.2.0

type IntegerNumber interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

type MNode added in v1.2.0

type MNode[T any] struct {
	// contains filtered or unexported fields
}

type Matrix added in v1.2.0

type Matrix[T any] [][]MNode[T]

Jump to

Keyboard shortcuts

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