Documentation ¶
Index ¶
- func Base64Decode[T typez.StrOrBytes](s T, enc *base64.Encoding) ([]byte, error)
- func Base64DecodeToString[T typez.StrOrBytes](s T, enc *base64.Encoding) (string, error)
- func Base64Encode[T typez.StrOrBytes](s T, enc *base64.Encoding) []byte
- func Base64EncodeToString[T typez.StrOrBytes](s T, enc *base64.Encoding) string
- func CamelCaseToSnake(str string) string
- func HexDecode[T typez.StrOrBytes](s T) ([]byte, error)
- func HexDecodeInPlace(b []byte) (int, error)
- func HexDecodeToString[T typez.StrOrBytes](s T) (string, error)
- func HexEncode[T typez.StrOrBytes](s T) []byte
- func HexEncodeToString[T typez.StrOrBytes](s T) string
- func IPv4ToLong(ip string) uint32
- func LcFirst(s string) string
- func Len(s string) int
- func LongToIPv4(long uint32) string
- func Mask(str, mask string, start, end int) string
- func OctalDecode[T typez.StrOrBytes](s T) []byte
- func OctalDecodeInPlace(b []byte) int
- func OctalDecodeToString[T typez.StrOrBytes](s T) string
- func OctalEncode[T typez.StrOrBytes](s T) []byte
- func OctalEncodeToString[T typez.StrOrBytes](s T) string
- func ParseUint[T typez.StrOrBytes](s T, base int, bitSize int) (uint64, error)
- func RemoveRunes(s string, shouldRemove func(rune) bool) string
- func Rev(s string) string
- func SnakeToCamelCase(str string, firstUp bool) string
- func Sub(s string, start, length int) string
- func SubByDisplay(s string, length int) string
- func ToString(value any) string
- func UcFirst(s string) string
- func UnsafeBytes(s string) []byte
- func UnsafeStrOrBytesToBytes[T typez.StrOrBytes](s T) []byte
- func UnsafeString(b []byte) string
- type KeyGenerator
- type Reader
- func (r *Reader[T]) Bytes() []byte
- func (r *Reader[T]) Close() error
- func (r *Reader[T]) Len() int
- func (r *Reader[T]) Read(p []byte) (n int, err error)
- func (r *Reader[T]) ReadAt(b []byte, off int64) (n int, err error)
- func (r *Reader[T]) ReadByte() (byte, error)
- func (r *Reader[T]) Reset(s T)
- func (r *Reader[T]) Seek(offset int64, whence int) (int64, error)
- func (r *Reader[T]) Size() int64
- func (r *Reader[T]) UnreadByte() error
- func (r *Reader[T]) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode returns the bytes represented by the base64 s
func Base64DecodeToString ¶
Base64DecodeToString returns the string represented by the base64 s
func Base64Encode ¶
func Base64Encode[T typez.StrOrBytes](s T, enc *base64.Encoding) []byte
Base64Encode returns the base64 encoding of s
func Base64EncodeToString ¶
func Base64EncodeToString[T typez.StrOrBytes](s T, enc *base64.Encoding) string
Base64EncodeToString returns the base64 encoding of s
func CamelCaseToSnake ¶
CamelCaseToSnake converts a camel case string to a snake case string
func HexDecode ¶
func HexDecode[T typez.StrOrBytes](s T) ([]byte, error)
HexDecode returns the bytes represented by the hexadecimal s
func HexDecodeInPlace ¶
HexDecodeInPlace decodes the hexadecimal s in place
func HexDecodeToString ¶
func HexDecodeToString[T typez.StrOrBytes](s T) (string, error)
HexDecodeToString returns the string represented by the hexadecimal s
func HexEncode ¶
func HexEncode[T typez.StrOrBytes](s T) []byte
HexEncode returns the hex encoding of s
func HexEncodeToString ¶
func HexEncodeToString[T typez.StrOrBytes](s T) string
HexEncodeToString returns the hex encoding of s
func LongToIPv4 ¶
LongToIPv4 converts a uint32 to an IPv4 address
func OctalDecode ¶
func OctalDecode[T typez.StrOrBytes](s T) []byte
OctalDecode returns the bytes represented by the octal s
func OctalDecodeInPlace ¶
OctalDecodeInPlace decodes the octal s in place
func OctalDecodeToString ¶
func OctalDecodeToString[T typez.StrOrBytes](s T) string
OctalDecodeToString returns the string represented by the octal s
func OctalEncode ¶
func OctalEncode[T typez.StrOrBytes](s T) []byte
OctalEncode returns the octal encoding of s
func OctalEncodeToString ¶
func OctalEncodeToString[T typez.StrOrBytes](s T) string
OctalEncodeToString returns the octal encoding of s
func ParseUint ¶
ParseUint is like ParseInt but for unsigned numbers.
A sign prefix is not permitted.
func RemoveRunes ¶
RemoveRunes removes the specified characters from the string
func SnakeToCamelCase ¶
SnakeToCamelCase converts a snake case string to a camel case string
func Sub ¶
Sub return a substring of a string by start position and length. If length is -1, the substring starting from start position to the end of the string will be returned.
func SubByDisplay ¶
SubByDisplay returns a substring of a string by display width
func UnsafeBytes ¶
UnsafeBytes converts string to byte slice. maybe safe risk
func UnsafeStrOrBytesToBytes ¶
func UnsafeStrOrBytesToBytes[T typez.StrOrBytes](s T) []byte
UnsafeStrOrBytesToBytes converts string or byte slice to byte slice. maybe safe risk
Types ¶
type KeyGenerator ¶
type KeyGenerator struct {
// contains filtered or unexported fields
}
KeyGenerator is a key generator.
func NewKeyGenerator ¶
func NewKeyGenerator(delimiter string, parts ...string) KeyGenerator
NewKeyGenerator creates a new key generator.
func (KeyGenerator) Generate ¶
func (k KeyGenerator) Generate(parts ...string) string
Generate generates a key.
func (KeyGenerator) Spread ¶
func (k KeyGenerator) Spread() []string
Spread returns the spread of the key.
func (KeyGenerator) With ¶
func (k KeyGenerator) With(parts ...string) KeyGenerator
With returns a new key generator with the given parts.
type Reader ¶
type Reader[T typez.StrOrBytes] struct { // contains filtered or unexported fields }
Reader is a wrapper around a string or byte slice that implements io.Reader,
func NewReader ¶
func NewReader[T typez.StrOrBytes](s T) *Reader[T]
NewReader returns a new Reader reading from s.
func (*Reader[T]) UnreadByte ¶
UnreadByte unreads the last byte. Only the most recently read byte can be unread.