Documentation
¶
Index ¶
- Constants
- Variables
- func ArrayContains[R comparable](a []R, v R) bool
- func CloseSilently(ctx context.Context, close func() error)
- func IsDecimalString(s string) bool
- func IsHeximalString(s string) bool
- func RandomDecimalString(n int) string
- func RandomHeximalString(n int) string
- func RandomNaturalNumber(n int) int
- func RandomString(n int, alphabet string) string
- func ToArrayString(a []interface{}) ([]string, bool)
- func ToString(any interface{}) string
Constants ¶
const ( UpperEnglishLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" LowerEnglishLetters = "abcdefghijklmnopqrstuvwxyz" UpperUnicodeLetters = UpperEnglishLetters + "ÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÈÉẺẼẸÊỀẾỂỄỆÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰ" LowerUnicodeLetters = LowerEnglishLetters + "àáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữự" DecimalDigits = "0123456789" EnglishLetters = UpperEnglishLetters + LowerEnglishLetters UnicodeLetters = UpperUnicodeLetters + LowerUnicodeLetters AlphaNumericCharacters = EnglishLetters + DecimalDigits )
Some alphabets
Variables ¶
var CompiledRegex = struct { DecimalString *regexp.Regexp HeximalString *regexp.Regexp }{ DecimalString: regexp.MustCompile("^[0-9]+$"), HeximalString: regexp.MustCompile("^[0-9a-f]+$"), }
CompiledRegex contains some compiled common regex
Functions ¶
func ArrayContains ¶
func ArrayContains[R comparable](a []R, v R) bool
ArrayContains checks if array a[] contains value v or not
func CloseSilently ¶
CloseSilently closes and write log if an error occurs
func IsDecimalString ¶
IsDecimalString checks if string contains only decimal digits or not
func IsHeximalString ¶
IsHeximalString checks if string contains only heximal digits or not
func RandomDecimalString ¶
RandomDecimalString generates a random string consisting of decimal digits
func RandomHeximalString ¶
RandomHeximalString generates a random string consisting of heximal digits
func RandomNaturalNumber ¶
RandomNaturalNumber generates a random natural number that is less than n
func RandomString ¶
RandomString generates a random string consisting of characters in the provided alphabet
func ToArrayString ¶
ToArrayString converts from array of interface{} to array of string
Types ¶
This section is empty.