detc

package
v0.0.0-...-b1846a3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgSplitter

func ArgSplitter(input string) []string

ArgSplitter is used to split a string into an array of strings using whitespace as a seperator, while also taking into account quotes and escapes

func Between

func Between(s, after, before string) (string, bool)

Between returns the contents of a string between before and after, yes its messy but it works

func CheckPrefixes

func CheckPrefixes(text string, prefixes []string) int

CheckPrefixes checks if a message contains any of the prefixes listed in a string array This function automatically converts the message to lowercase, thus the prefix check is case insensitive and all given prefixes must be in lowercase Returns the length of the prefix if true, returns -1 if false, if the text is the same lenght as the prefix it will also return -1

func CombineUntil

func CombineUntil(s []string, max int, sep string) []string

CombineUntil uses similar logic to SplitLenght, except that it takes an array of strings directly rather than splitting them itself it essentially tries to combine the input strings until its as close to max length but not over, and returns an array of strings which are combined from s to be as close to max

func FormatterThing

func FormatterThing(s string) string

FormatterThing does some really basic formatting on a string, replacing spaces with linebreaks and adding indentation based off of {} brackets

func GetDateString

func GetDateString() string

GetDateString , Returns a string of the Current date in YYYY-MM-DD format

func GetRFC3339DateString

func GetRFC3339DateString() string

GetRFC3339DateString , Returns the current time in RFC3339 Standardised Format

func GetTimeDateString

func GetTimeDateString() string

GetTimeDateString , Returns a string of the date and time using GetDateString and GetTimeString seperated by an underscore

func GetTimeString

func GetTimeString() string

GetTimeString , Returns a string of the current time in 24h HH:MM:SS format

func IndexRemover

func IndexRemover(args []string, remove ...int) []string

IndexRemover returns a new array of strings containing the contents of args but with any of the marked indexes removed

func Prepend

func Prepend(s string, r []string) []string

Prepend Function Basically like the default append function but for prepending

func RemoveFromSliceString

func RemoveFromSliceString(s []string, pos int) []string

RemoveFromSliceString removes an index from a slice of strings

func SortByLongestFirst

func SortByLongestFirst(s []string) []string

SortByLongestFirst sorts an array of strings by their length, placing the longest first

func SplitLength

func SplitLength(s string, max int, sep string) []string

SplitLength is similar to strings.SplitAfter except it only splits on sep when a string exceedes a certain max length, the splitting behaviour attemps to keep all returned strings as close to but below the max lenght. note that as it only splits on instances of seperator any segment larger than the max that does not contain sep will remain intact and thus will be larger than max, as such the string length is not gaurenteed to be below the max.

func StrrayToStr

func StrrayToStr(seperator string, a ...string) (b string)

StrrayToStr converts any amount of strings into a single string

Types

This section is empty.

Jump to

Keyboard shortcuts

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