Documentation ¶
Overview ¶
Package zstring provides String related operations
Index ¶
- func AesDecrypt(cipherText []byte, key string, iv ...string) (plainText []byte, err error)
- func AesDecryptString(cipherText string, key string, iv ...string) (string, error)
- func AesEncrypt(plainText []byte, key string, iv ...string) (ciphertext []byte, err error)
- func AesEncryptString(plainText string, key string, iv ...string) (string, error)
- func AesGCMDecrypt(ciphertext []byte, key string) (plaintext []byte, err error)
- func AesGCMDecryptString(cipherText string, key string) (string, error)
- func AesGCMEncrypt(plaintext []byte, key string) (ciphertext []byte, err error)
- func AesGCMEncryptString(plainText string, key string) (string, error)
- func Base64Decode(data []byte) (value []byte, err error)
- func Base64DecodeString(data string) (value string, err error)
- func Base64Encode(value []byte) []byte
- func Base64EncodeString(value string) string
- func Buffer(size ...int) *strings.Builder
- func Bytes2String(b []byte) string
- func CamelCaseToSnakeCase(str string, delimiter ...string) string
- func Expand(s string, process func(key string) string) string
- func GenRSAKey(bits ...int) (prvkey, pubkey []byte, err error)
- func Img2Base64(path string) (string, error)
- func IsLcfirst(str string) bool
- func IsPattern(str string) bool
- func IsUcfirst(str string) bool
- func Lcfirst(str string) string
- func Len(str string) int
- func Match(str, pattern string) bool
- func Md5(s string) string
- func Md5Byte(s []byte) string
- func Md5File(path string) (encrypt string, err error)
- func NewFilter(words []string, mask ...rune) *filterNode
- func NewReplacer(mapping map[string]string) *replacer
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) ([]byte, error)
- func Pad(raw string, length int, padStr string, padType PadType) string
- func ParseID(id int64) (t time.Time, ts int64, workerId int64, seq int64)
- func ProjectMd5() string
- func RSADecrypt(cipherText []byte, privateKey string, bits ...int) ([]byte, error)
- func RSADecryptString(cipherText string, privateKey string) (string, error)
- func RSAEncrypt(plainText []byte, publicKey string, bits ...int) ([]byte, error)
- func RSAEncryptString(plainText string, publicKey string) (string, error)
- func RSAKeyDecrypt(cipherText []byte, privateKey *rsa.PrivateKey, bits ...int) ([]byte, error)
- func RSAKeyEncrypt(plainText []byte, publicKey *rsa.PublicKey, bits ...int) ([]byte, error)
- func RSAPriKeyEncrypt(plainText []byte, privateKey string) ([]byte, error)
- func RSAPriKeyEncryptString(plainText string, privateKey string) (string, error)
- func RSAPubKeyDecrypt(cipherText []byte, publicKey string) ([]byte, error)
- func RSAPubKeyDecryptString(cipherText string, publicKey string) (string, error)
- func Rand(n int, tpl ...string) string
- func RandInt(min int, max int) int
- func RandUint32() uint32
- func RandUint32Max(max uint32) uint32
- func RegexExtract(pattern string, str string) ([]string, error)
- func RegexExtractAll(pattern string, str string, count ...int) ([][]string, error)
- func RegexFind(pattern string, str string, count int) [][]int
- func RegexMatch(pattern string, str string) bool
- func RegexReplace(pattern string, str, repl string) (string, error)
- func RegexReplaceFunc(pattern string, str string, repl func(string) string) (string, error)
- func RegexSplit(pattern string, str string) ([]string, error)
- func Serialize(value interface{}) ([]byte, error)
- func SnakeCaseToCamelCase(str string, ucfirst bool, delimiter ...string) string
- func String2Bytes(s string) []byte
- func Substr(str string, start int, length ...int) string
- func TrimBOM(fileBytes []byte) []byte
- func TrimLine(s string) string
- func TrimSpace(s string) string
- func UUID() int64
- func Ucfirst(str string) string
- func UnSerialize(valueBytes []byte, registers ...interface{}) (value interface{}, err error)
- func UniqueID(n int) string
- func UrlDecode(str string) (string, error)
- func UrlEncode(str string) string
- func UrlRawDecode(str string) (string, error)
- func UrlRawEncode(str string) string
- func WeightedRand(choices map[interface{}]uint32) (interface{}, error)
- func XSSClean(str string) string
- type IDWorker
- type PadType
- type Weighteder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶ added in v1.1.20
AesDecrypt aes decryption
func AesDecryptString ¶ added in v1.1.20
AesDecryptString Aes Decrypt to String
func AesEncrypt ¶ added in v1.1.20
AesEncrypt aes encryption
func AesEncryptString ¶ added in v1.1.20
AesEncryptString Aes Encrypt to String
func AesGCMDecrypt ¶ added in v1.3.5
func AesGCMDecryptString ¶ added in v1.3.5
func AesGCMEncrypt ¶ added in v1.3.5
func AesGCMEncryptString ¶ added in v1.3.5
func Base64Decode ¶ added in v0.1.20
func Base64DecodeString ¶ added in v0.1.20
func Base64Encode ¶ added in v0.1.20
func Base64EncodeString ¶ added in v0.1.20
func CamelCaseToSnakeCase ¶ added in v0.0.19
CamelCaseToSnakeCase camelCase To SnakeCase helloWorld/HelloWorld => hello_world
func Img2Base64 ¶ added in v0.1.46
Img2Base64 read picture files and convert to base 64 strings
func NewReplacer ¶ added in v0.1.59
func PKCS7Padding ¶ added in v0.1.63
PKCS7Padding PKCS7 fill mode
func PKCS7UnPadding ¶ added in v0.1.63
PKCS7UnPadding Reverse operation of padding to delete the padding string
func ProjectMd5 ¶ added in v1.5.1
func ProjectMd5() string
func RSADecrypt ¶ added in v1.1.20
RSADecrypt RSA Decrypt
func RSADecryptString ¶ added in v1.1.20
RSADecryptString RSA Decrypt to String
func RSAEncrypt ¶ added in v1.1.20
RSAEncrypt RSA Encrypt
func RSAEncryptString ¶ added in v1.1.20
RSAEncryptString RSA Encrypt to String
func RSAKeyDecrypt ¶ added in v1.3.5
RSAKeyDecrypt RSA Decrypt
func RSAKeyEncrypt ¶ added in v1.3.5
RSAKeyEncrypt RSA Encrypt
func RSAPriKeyEncrypt ¶ added in v1.1.21
RSAPriKeyEncrypt RSA PriKey Encrypt
func RSAPriKeyEncryptString ¶ added in v1.1.21
RSAPriKeyEncryptString RSA PriKey Encrypt to String
func RSAPubKeyDecrypt ¶ added in v1.1.21
RSAPubKeyDecrypt RSA PubKey Decrypt
func RSAPubKeyDecryptString ¶ added in v1.1.21
RSAPubKeyDecryptString RSA PubKey Decrypt to String
func Rand ¶
Rand random string of specified length, the second parameter limit can only appear the specified character
func RandUint32 ¶ added in v0.1.53
func RandUint32() uint32
func RandUint32Max ¶ added in v0.1.53
RandUint32Max returns pseudorandom uint32 in the range [0..max)
func RegexExtract ¶ added in v0.0.19
RegexExtract extract matching text
func RegexExtractAll ¶ added in v0.1.42
RegexExtractAll extract matching all text
func RegexMatch ¶ added in v0.0.19
RegexMatch check for match
func RegexReplace ¶ added in v0.0.19
RegexReplace replacing matches of the Regexp
func RegexReplaceFunc ¶ added in v0.0.19
RegexReplaceFunc replacing matches of the Regexp
func RegexSplit ¶ added in v1.6.1
RegexSplit split the string
func SnakeCaseToCamelCase ¶ added in v0.0.19
SnakeCaseToCamelCase snakeCase To CamelCase: hello_world => helloWorld
func String2Bytes ¶
String2Bytes string to bytes remark: read only, the structure of runtime changes will be affected, the role of unsafe.Pointer will be changed, and it will also be affected
func UnSerialize ¶ added in v0.1.43
func UrlRawDecode ¶ added in v0.1.20
UrlRawDecode Decode URL-encoded strings.
func UrlRawEncode ¶ added in v0.1.20
UrlRawEncode URL-encode according to RFC 3986.
func WeightedRand ¶ added in v1.6.4
Types ¶
type IDWorker ¶ added in v0.1.35
IDWorker Struct
func NewIDWorker ¶ added in v0.1.35
NewIDWorker Generate NewIDWorker with Given workerid
type Weighteder ¶ added in v1.6.4
type Weighteder struct {
// contains filtered or unexported fields
}
func NewWeightedRand ¶ added in v1.6.4
func NewWeightedRand(choices map[interface{}]uint32) (*Weighteder, error)
func (*Weighteder) Pick ¶ added in v1.6.4
func (w *Weighteder) Pick() interface{}