Documentation
¶
Index ¶
- Constants
- Variables
- func AtInside(s []string, f string) (int, bool)
- func BB(s string) (b []byte)
- func Base64(in string) string
- func Base64JSON(in map[string]string) string
- func ChunkBy[T any](items []T, chunkSize int) (chunks [][]T)
- func Cleanse(in string) string
- func CombineSlices(first []string, second []string) []string
- func Contains(s []string, e string) bool
- func ContainsInt(s []int, e int) bool
- func DuplicateString(s string, n int) string
- func ExtractNumbers(str string) int
- func Fib() func() int
- func HasNextIdx(s []string, i int) bool
- func HasNumber(str string) bool
- func HumanReadableFileMode(fm fs.FileMode) (string, error)
- func IsInside(s []string, e string) bool
- func IsYes(s string) bool
- func KeepNumbers(str string) string
- func Max(x, y int) int
- func MergeByteSlices(slices ...[]byte) []byte
- func MergeStringSlices(slices ...[]string) []string
- func PadNumber(number string) string
- func Prepend(existing []any, items ...any) (out []any)
- func RandomBytes() []byte
- func RandomInt(limit int) int
- func RandomRangeInt(start int, limit int) int
- func RandomString(n int) string
- func RemoveDirectorySlashes(directory string) string
- func RemoveNumbers(str string) string
- func ReplaceAllCaseInsensitive(input, old, new string) string
- func ReplaceIfInside(insideThis []string, lookingAt string, replaceLookingForWith string) (string, bool)
- func ReplaceInside(s []string, f string, r string) ([]string, bool)
- func ReplaceNonNumbers(str string, repl string) string
- func ReplaceNumbers(str string, repl string) string
- func ReverseString(s string) string
- func WrapText(text string, maxWidth int) string
Constants ¶
View Source
const ( LetterIdxBits = 6 // 6 bits to represent a letter index LetterIdxMask = 1<<LetterIdxBits - 1 // All 1-bits, as many as letterIdxBits LetterIdxMax = 63 / LetterIdxBits // # of letter indices fitting in 63 bits )
View Source
const LetterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Variables ¶
View Source
var NonAlphanumericRegex = regexp.MustCompile(`[^a-zA-Z]+`)
View Source
var NonNumericRegex = regexp.MustCompile(`[^0-9]+`)
View Source
var RandSource = rand.NewSource(time.Now().UTC().UnixNano())
Functions ¶
func Base64JSON ¶
func CombineSlices ¶
func ContainsInt ¶
func DuplicateString ¶
func ExtractNumbers ¶
func HasNextIdx ¶
HasNextIdx is a wrapped safety check for a slice to ensure if an action is about to occur on an index, that the index exists first as a bool
func IsInside ¶
IsInside acts like strings.Contains but lets you pass in a slice of strings instead of just a string
func KeepNumbers ¶
func MergeByteSlices ¶
func MergeStringSlices ¶
func RandomBytes ¶
func RandomBytes() []byte
func RandomRangeInt ¶
RandomRangeInt return a random int that is between start and limit, will recursively run until match found
func RandomString ¶
func RemoveDirectorySlashes ¶
func RemoveNumbers ¶
func ReplaceIfInside ¶
func ReplaceIfInside(insideThis []string, lookingAt string, replaceLookingForWith string) (string, bool)
ReplaceIfInside looks inside a slice of strings for a given string
func ReplaceInside ¶
ReplaceInside searches for f inside s and replaces f with r and returns a modified s along with a bool if it worked
func ReplaceNonNumbers ¶
func ReplaceNumbers ¶
func ReverseString ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.