stringsutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(value string, a string) (string, error)

After extracts the string after a from value returns value as is and error if a is not found

func Before

func Before(value string, a string) (string, error)

Before extracts the string before a from value returns value as is and error if a is not found

func Between

func Between(value string, a string, b string) (string, error)

Between extracts the string between a and b returns value as is and error if a or b are not found

func ContainsAny

func ContainsAny(s string, ss ...string) bool

ContainsAny returns true is s contains any specified substring

func EqualFoldAny

func EqualFoldAny(s string, ss ...string) bool

EqualFoldAny returns true if s is equal to any specified substring

func HasPrefixAny

func HasPrefixAny(s string, prefixes ...string) bool

HasPrefixAny checks if the string starts with any specified prefix

func HasPrefixI

func HasPrefixI(s, prefix string) bool

HasPrefixI is case insensitive HasPrefix

func HasSuffixAny

func HasSuffixAny(s string, suffixes ...string) bool

HasSuffixAny checks if the string ends with any specified suffix

func HasSuffixI

func HasSuffixI(s, suffix string) bool

HasSuffixI is case insensitive HasSuffix

func IndexAt

func IndexAt(s, sep string, n int) int

IndexAt look for a substring starting at position x

func Join

func Join(elems []interface{}, sep string) string

Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

func ReplaceAll

func ReplaceAll(s, new string, olds ...string) string

ReplaceAll returns a copy of the string s with all instances of old incrementally replaced by new.

func Reverse

func Reverse(s string) string

Reverse the string

func SlideWithLength

func SlideWithLength(s string, l int) chan string

SlideWithLength returns all the strings of the specified length while moving forward the extraction window

func SplitAny

func SplitAny(s string, seps ...string) []string

SplitAny string by a list of separators

func TrimPrefixAny

func TrimPrefixAny(s string, prefixes ...string) string

TrimPrefixAny trims all prefixes from string in order

func TrimSuffixAny

func TrimSuffixAny(s string, suffixes ...string) string

TrimSuffixAny trims all suffixes from string in order

func Truncate

func Truncate(data string, maxSize int) string

Truncate a string to max length

Types

type LongestSequence

type LongestSequence struct {
	Sequence string
	Count    int
}

func LongestRepeatingSequence

func LongestRepeatingSequence(s string) LongestSequence

LongestRepeatingSequence finds the longest repeating non-overlapping sequence in a string

Jump to

Keyboard shortcuts

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