Documentation ¶
Index ¶
- func CutFromLeft(s, sep string) (before, after string, found bool)
- func CutFromRight(s, sep string) (before, after string, found bool)
- func FromBytes(b *[]byte) string
- func RandomBase64(n int) string
- func RandomBytes(n int) []byte
- func RandomHex(n int) string
- func RandomString(n int, letters ...string) string
- func SumByFNV64a(s string, ss ...string) string
- func SumBySHA224(s string, ss ...string) string
- func SumBySHA256(s string, ss ...string) string
- func SumBytesByFNV64a(bs []byte, bss ...[]byte) string
- func SumBytesBySHA224(bs []byte, bss ...[]byte) string
- func SumBytesBySHA256(bs []byte, bss ...[]byte) string
- func ToBytes(s *string) (bs []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CutFromLeft ¶
CutFromLeft is the same as strings.Cut, which starts from left to right, slices s around the first instance of sep, returning the text before and after sep. The found result reports whether sep appears in s. If sep does not appear in s, cut returns s, "", false.
func CutFromRight ¶
CutFromRight takes the same arguments as CutFromLeft, but starts from right to left, slices s around the last instance of sep, return the text before and after sep. The found result reports whether sep appears in s. If sep does not appear in s, cut returns s, "", false.
func RandomBase64 ¶ added in v0.6.1
RandomBase64 generates a random base64 string with length of n, safe for URL.
func RandomBytes ¶ added in v0.6.1
RandomBytes generates n random bytes.
func RandomHex ¶ added in v0.6.1
RandomHex generates a random hex string with length of n e.g: 67aab2d956bd7cc621af22cfb169cba8.
func RandomString ¶ added in v0.6.1
RandomString generates a random string using only letters provided in the letters parameter if user omit letters parameters, this function will use defLetters instead.
func SumByFNV64a ¶
SumByFNV64a sums up the string(s) by FNV-64a hash algorithm.
func SumBySHA224 ¶
SumBySHA224 sums up the string(s) by SHA224 hash algorithm.
func SumBySHA256 ¶
SumBySHA256 sums up the string(s) by SHA256 hash algorithm.
func SumBytesByFNV64a ¶
SumBytesByFNV64a sums up the byte slice(s) by FNV-64a hash algorithm.
func SumBytesBySHA224 ¶
SumBytesBySHA224 sums up the byte slice(s) by SHA224 hash algorithm.
func SumBytesBySHA256 ¶
SumBytesBySHA256 sums up the byte slice(s) by SHA256 hash algorithm.
Types ¶
This section is empty.