stringutil

package
v1.106.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// KiB is bytes per Kibibyte
	KiB
	// MiB is bytes per Mebibyte
	MiB
	// GiB is bytes per Gibibyte
	GiB
	// TiB is bytes per Tebibyte
	TiB
)

Variables

This section is empty.

Functions

func Bank

func Bank(s string) string

Bank will return a non-copy of a string if it has been used before. Otherwise, it will store the string as the unique instance.

func BankFunc added in v1.97.0

func BankFunc(s string, f func() string) string

BankFunc will use the provided s string to check for an existing allocation of the string. However, if no allocation exists, the f parameter will be used to create the string and store in the bank.

func ClearBank added in v1.97.0

func ClearBank()

func DeleteEmptyStringsFromArray added in v1.99.0

func DeleteEmptyStringsFromArray(input []string) (output []string)

DeleteEmptyStringsFromArray removes the empty strings from an array.

func FormatBytes

func FormatBytes(numBytes int64) string

FormatBytes takes a number of bytes and formats it as a string

func FormatUTCOffset

func FormatUTCOffset(dur time.Duration) string

FormatUTCOffset converts a duration to a string of format "-07:00"

func RandSeq

func RandSeq(n int) string

RandSeq generates a pseudo-random alphabetic string of the given length

func StringSlicesEqual

func StringSlicesEqual(left, right []string) bool

StringSlicesEqual checks if two string slices with arbitrary order have the same elements

Types

This section is empty.

Jump to

Keyboard shortcuts

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