From 72093e46d1ee65ffc0b7b9361759cbd3856d3dd4 Mon Sep 17 00:00:00 2001 From: kakuilan Date: Mon, 27 Mar 2023 16:26:25 +0800 Subject: [PATCH] fix version --- README.md | 2 +- docs/README.md | 2 +- docs/changelog.md | 16 + docs/v0.4.1.md | 4021 +++++++++++++++++++++++++++++++++++++++++++++ kgo.go | 2 +- 5 files changed, 4040 insertions(+), 3 deletions(-) create mode 100644 docs/v0.4.1.md diff --git a/README.md b/README.md index 659d34d..a05e277 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ golang 常用函数库/工具集,仅测试支持有限的64位系统. ### 依赖第三方库 - github.com/json-iterator/go -- github.com/StackExchange/wmi +- github.com/yusufpapurcu/wmi ### 安装使用 diff --git a/docs/README.md b/docs/README.md index f052ec2..ee2b82d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ http://192.168.1.1:6060/pkg/github.com/kakuilan ```sh go get -d github.com/robertkrimen/godocdown/godocdown -godocdown . > docs/v0.4.0.md +godocdown . > docs/v0.4.1.md ``` ### 安装依赖 diff --git a/docs/changelog.md b/docs/changelog.md index 1e7412e..808e181 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. +## [v0.4.1]- 2023-03-27 + +#### Added + +- none + +#### Fixed + +- none + +#### Changed + +- 修改`KStr.PasswordSafeLevel`,先检查是否弱密码 + +#### Removed + ## [v0.4.0]- 2023-02-24 #### Added diff --git a/docs/v0.4.1.md b/docs/v0.4.1.md new file mode 100644 index 0000000..0d4dafb --- /dev/null +++ b/docs/v0.4.1.md @@ -0,0 +1,4021 @@ +# kgo + + import "github.com/kakuilan/kgo" + + +## Usage + +```go +const ( + // Version 版本号 + Version = "0.4.1" + + // KDelimiter 本库自定义分隔符 + KDelimiter = "$@#KSYSK#@$" + + Unknown = "Unknown" + + //UINT_MAX 无符号整型uint最大值 + UINT_MAX = ^uint(0) + + //UINT8_MAX 无符号整型uint8最大值, 255 + UINT8_MAX = ^uint8(0) + + //UINT16_MAX 无符号整型uint16最大值, 65535 + UINT16_MAX = ^uint16(0) + + //UINT32_MAX 无符号整型uint32最大值, 4294967295 + UINT32_MAX = ^uint32(0) + + //UINT64_MAX 无符号整型uint64最大值, 18446744073709551615 + UINT64_MAX = ^uint64(0) + + //INT_MAX 有符号整型int最大值 + INT_MAX = int(^uint(0) >> 1) + //INT_MIN 有符号整型int最小值 + INT_MIN = ^INT_MAX + + //INT32_MAX 有符号整型int32最大值, 2147483647 + INT32_MAX = int32(^uint32(0) >> 1) + //INT32_MIN 有符号整型int32最小值, -2147483648 + INT32_MIN = ^INT32_MAX + + //INT64_MAX 有符号整型int64最大值, 9223372036854775807 + INT64_MAX = int64(^uint64(0) >> 1) + //INT64_MIN 有符号整型int64最小值, -9223372036854775808 + INT64_MIN = ^INT64_MAX + + // FILE_COVER_ALLOW 文件覆盖,允许 + FILE_COVER_ALLOW LkkFileCover = 1 + // FILE_COVER_IGNORE 文件覆盖,忽略 + FILE_COVER_IGNORE LkkFileCover = 0 + // FILE_COVER_DENY 文件覆盖,禁止 + FILE_COVER_DENY LkkFileCover = -1 + + // FILE_TYPE_ANY 文件类型-任意 + FILE_TYPE_ANY LkkFileType = 0 + // FILE_TYPE_LINK 文件类型-链接文件 + FILE_TYPE_LINK LkkFileType = 1 + // FILE_TYPE_REGULAR 文件类型-常规文件(不包括链接) + FILE_TYPE_REGULAR LkkFileType = 2 + // FILE_TYPE_COMMON 文件类型-普通文件(包括常规和链接) + FILE_TYPE_COMMON LkkFileType = 3 + + // FILE_TREE_ALL 文件树,查找所有(包括目录和文件) + FILE_TREE_ALL LkkFileTree = 3 + // FILE_TREE_DIR 文件树,仅查找目录 + FILE_TREE_DIR LkkFileTree = 2 + // FILE_TREE_FILE 文件树,仅查找文件 + FILE_TREE_FILE LkkFileTree = 1 + + // RAND_STRING_ALPHA 随机字符串类型,字母 + RAND_STRING_ALPHA LkkRandString = 0 + // RAND_STRING_NUMERIC 随机字符串类型,数值 + RAND_STRING_NUMERIC LkkRandString = 1 + // RAND_STRING_ALPHANUM 随机字符串类型,字母+数值 + RAND_STRING_ALPHANUM LkkRandString = 2 + // RAND_STRING_SPECIAL 随机字符串类型,字母+数值+特殊字符 + RAND_STRING_SPECIAL LkkRandString = 3 + // RAND_STRING_CHINESE 随机字符串类型,仅中文 + RAND_STRING_CHINESE LkkRandString = 4 + + // CASE_NONE 忽略大小写 + CASE_NONE LkkCaseSwitch = 0 + // CASE_LOWER 检查小写 + CASE_LOWER LkkCaseSwitch = 1 + // CASE_UPPER 检查大写 + CASE_UPPER LkkCaseSwitch = 2 + + // PAD_LEFT 左侧填充 + PAD_LEFT LkkPadType = 0 + // PAD_RIGHT 右侧填充 + PAD_RIGHT LkkPadType = 1 + // PAD_BOTH 两侧填充 + PAD_BOTH LkkPadType = 2 + + // PKCS_NONE 不进行填充 + PKCS_NONE LkkPKCSType = -1 + // PKCS_ZERO PKCS 0值填充 + PKCS_ZERO LkkPKCSType = 0 + // PKCS_SEVEN 即PKCS7 + PKCS_SEVEN LkkPKCSType = 7 + + // COMPARE_ONLY_VALUE 仅比较值 + COMPARE_ONLY_VALUE LkkArrCompareType = 0 + // COMPARE_ONLY_KEY 仅比较键 + COMPARE_ONLY_KEY LkkArrCompareType = 1 + // COMPARE_BOTH_KEYVALUE 同时比较键和值 + COMPARE_BOTH_KEYVALUE LkkArrCompareType = 2 + + //默认浮点数精确小数位数 + FLOAT_DECIMAL uint8 = 8 + + //AuthCode 动态密钥长度,须<32 + DYNAMIC_KEY_LEN = 8 + + //检查连接超时的时间 + CHECK_CONNECT_TIMEOUT = time.Second * 5 + + // 正则模式-全中文 + PATTERN_CHINESE_ALL = "^[\u4e00-\u9fa5]+$" + + // 正则模式-中文名称 + PATTERN_CHINESE_NAME = "^[\u4e00-\u9fa5][.•·\u4e00-\u9fa5]{0,30}[\u4e00-\u9fa5]$" + + // 正则模式-多字节字符 + PATTERN_MULTIBYTE = "[^\x00-\x7F]" + + // 正则模式-ASCII字符 + PATTERN_ASCII = "^[\x00-\x7F]+$" + + // 正则模式-全角字符 + PATTERN_FULLWIDTH = "[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]" + + // 正则模式-半角字符 + PATTERN_HALFWIDTH = "[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]" + + // 正则模式-词语,不以下划线开头的中文、英文、数字、下划线 + PATTERN_WORD = "^[a-zA-Z0-9\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]+$" + + // 正则模式-浮点数 + PATTERN_FLOAT = `^([+-]?\d+)(\.\d+)$` + + // 正则模式-邮箱 + PATTERN_EMAIL = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" + + // 正则模式-用户名-英文 + PATTERN_USERNAMEEN = `^[a-zA-Z0-9_.]+$` + + // 正则模式-大陆手机号 + PATTERN_MOBILECN = `^1[3-9]\d{9}$` + + // 正则模式-固定电话 + PATTERN_TEL_FIX = `^(010|02\d{1}|0[3-9]\d{2})-\d{7,9}(-\d+)?$` + + // 正则模式-400或800 + PATTERN_TEL_4800 = `^[48]00\d?(-?\d{3,4}){2}$` + + // 正则模式-座机号(固定电话或400或800) + PATTERN_TELEPHONE = `(` + PATTERN_TEL_FIX + `)|(` + PATTERN_TEL_4800 + `)` + + // 正则模式-电话(手机或固话) + PATTERN_PHONE = `(` + PATTERN_MOBILECN + `)|(` + PATTERN_TEL_FIX + `)` + + // 正则模式-日期时间 + PATTERN_DATETIME = `^[0-9]{4}(|\-[0-9]{2}(|\-[0-9]{2}(|\s+[0-9]{2}(|:[0-9]{2}(|:[0-9]{2})))))$` + + // 正则模式-身份证号码,18位或15位 + PATTERN_CREDIT_NO = `(^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)` + + // 正则模式-小写英文 + PATTERN_ALPHA_LOWER = `^[a-z]+$` + + // 正则模式-大写英文 + PATTERN_ALPHA_UPPER = `^[A-Z]+$` + + // 正则模式-字母或数字 + PATTERN_ALPHA_NUMERIC = `^[a-zA-Z0-9]+$` + + // 正则模式-十六进制颜色 + PATTERN_HEXCOLOR = `^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$` + + // 正则模式-RGB颜色 + PATTERN_RGBCOLOR = "^rgb\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*\\)$" + + // 正则模式-全空白字符 + PATTERN_WHITESPACE_ALL = "^[[:space:]]+$" + + // 正则模式-带空白字符 + PATTERN_WHITESPACE_HAS = ".*[[:space:]]" + + // 正则模式-连续空白符 + PATTERN_WHITESPACE_DUPLICATE = `[[:space:]]{2,}|[\s\p{Zs}]{2,}` + + // 正则模式-base64字符串 + PATTERN_BASE64 = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$" + + // 正则模式-base64编码图片 + PATTERN_BASE64_IMAGE = `^data:\s*(image|img)\/(\w+);base64` + + // 正则模式-html标签 + PATTERN_HTML_TAGS = `<(.|\n)*?>` + + // 正则模式-DNS名称 + PATTERN_DNSNAME = `^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$` + + // 正则模式-MD5 + PATTERN_MD5 = `^(?i)([0-9a-h]{32})$` + + // 正则模式-SHA1 + PATTERN_SHA1 = `^(?i)([0-9a-h]{40})$` + + // 正则模式-SHA256 + PATTERN_SHA256 = `^(?i)([0-9a-h]{64})$` + + // 正则模式-SHA512 + PATTERN_SHA512 = `^(?i)([0-9a-h]{128})$` + + //正则模式-等式 x = y + PATTERN_EQUATION = `['"]?([\w\-]+)['"]?[\s]*=[\s]*['"]?(.*)['"]?` + + // 正则模式-emoji表情符 + PATTERN_EMOJI = `[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0077}\x{E006C}\x{E0073}\x{E007F})|[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0073}\x{E0063}\x{E0074}\x{E007F})|[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0065}\x{E006E}\x{E0067}\x{E007F})|[\x{1F3F4}](?:\x{200D}\x{2620}\x{FE0F})|[\x{1F3F3}](?:\x{FE0F}\x{200D}\x{1F308})|[\x{0023}\x{002A}\x{0030}\x{0031}\x{0032}\x{0033}\x{0034}\x{0035}\x{0036}\x{0037}\x{0038}\x{0039}](?:\x{FE0F}\x{20E3})|[\x{1F441}](?:\x{FE0F}\x{200D}\x{1F5E8}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467}\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F466}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F466})|[\x{1F468}](?:\x{200D}\x{1F468}\x{200D}\x{1F467}\x{200D}\x{1F467})|[\x{1F468}](?:\x{200D}\x{1F468}\x{200D}\x{1F466}\x{200D}\x{1F466})|[\x{1F468}](?:\x{200D}\x{1F468}\x{200D}\x{1F467}\x{200D}\x{1F466})|[\x{1F468}](?:\x{200D}\x{1F468}\x{200D}\x{1F467})|[\x{1F468}](?:\x{200D}\x{1F468}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F469}\x{200D}\x{1F467}\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F469}\x{200D}\x{1F466}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F469}\x{200D}\x{1F467}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F469}\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F469}\x{200D}\x{1F466})|[\x{1F469}](?:\x{200D}\x{2764}\x{FE0F}\x{200D}\x{1F469})|[\x{1F469}\x{1F468}](?:\x{200D}\x{2764}\x{FE0F}\x{200D}\x{1F468})|[\x{1F469}](?:\x{200D}\x{2764}\x{FE0F}\x{200D}\x{1F48B}\x{200D}\x{1F469})|[\x{1F469}\x{1F468}](?:\x{200D}\x{2764}\x{FE0F}\x{200D}\x{1F48B}\x{200D}\x{1F468})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F9B3})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F9B3})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F9B3})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F9B3})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F9B3})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F9B3})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F9B2})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F9B2})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F9B2})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F9B2})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F9B2})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F9B2})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F9B1})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F9B1})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F9B1})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F9B1})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F9B1})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F9B1})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F9B0})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F9B0})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F9B0})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F9B0})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F9B0})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F9B0})|[\x{1F575}\x{1F3CC}\x{26F9}\x{1F3CB}](?:\x{FE0F}\x{200D}\x{2640}\x{FE0F})|[\x{1F575}\x{1F3CC}\x{26F9}\x{1F3CB}](?:\x{FE0F}\x{200D}\x{2642}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FF}\x{200D}\x{2640}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FE}\x{200D}\x{2640}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FD}\x{200D}\x{2640}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FC}\x{200D}\x{2640}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FB}\x{200D}\x{2640}\x{FE0F})|[\x{1F46E}\x{1F9B8}\x{1F9B9}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F9DE}\x{1F9DF}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F46F}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93C}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{200D}\x{2640}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FF}\x{200D}\x{2642}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FE}\x{200D}\x{2642}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FD}\x{200D}\x{2642}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FC}\x{200D}\x{2642}\x{FE0F})|[\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{1F3FB}\x{200D}\x{2642}\x{FE0F})|[\x{1F46E}\x{1F9B8}\x{1F9B9}\x{1F482}\x{1F477}\x{1F473}\x{1F471}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F9DE}\x{1F9DF}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F46F}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93C}\x{1F93D}\x{1F93E}\x{1F939}](?:\x{200D}\x{2642}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F692})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F692})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F692})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F692})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F692})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F692})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F680})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F680})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F680})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F680})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F680})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F680})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{2708}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{2708}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{2708}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{2708}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{2708}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{200D}\x{2708}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F3A8})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F3A8})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F3A8})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F3A8})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F3A8})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F3A8})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F3A4})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F3A4})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F3A4})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F3A4})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F3A4})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F3A4})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F4BB})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F4BB})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F4BB})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F4BB})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F4BB})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F4BB})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F52C})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F52C})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F52C})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F52C})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F52C})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F52C})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F4BC})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F4BC})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F4BC})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F4BC})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F4BC})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F4BC})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F3ED})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F3ED})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F3ED})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F3ED})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F3ED})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F3ED})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F527})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F527})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F527})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F527})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F527})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F527})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F373})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F373})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F373})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F373})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F373})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F373})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F33E})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F33E})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F33E})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F33E})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F33E})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F33E})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{2696}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{2696}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{2696}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{2696}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{2696}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{200D}\x{2696}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F3EB})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F3EB})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F3EB})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F3EB})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F3EB})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F3EB})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{1F393})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{1F393})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{1F393})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{1F393})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{1F393})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F393})|[\x{1F468}\x{1F469}](?:\x{1F3FF}\x{200D}\x{2695}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FE}\x{200D}\x{2695}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FD}\x{200D}\x{2695}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FC}\x{200D}\x{2695}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{1F3FB}\x{200D}\x{2695}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{200D}\x{2695}\x{FE0F})|[\x{1F476}\x{1F9D2}\x{1F466}\x{1F467}\x{1F9D1}\x{1F468}\x{1F469}\x{1F9D3}\x{1F474}\x{1F475}\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F934}\x{1F478}\x{1F473}\x{1F472}\x{1F9D5}\x{1F9D4}\x{1F471}\x{1F935}\x{1F470}\x{1F930}\x{1F931}\x{1F47C}\x{1F385}\x{1F936}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F483}\x{1F57A}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F6C0}\x{1F6CC}\x{1F574}\x{1F3C7}\x{1F3C2}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}\x{1F933}\x{1F4AA}\x{1F9B5}\x{1F9B6}\x{1F448}\x{1F449}\x{261D}\x{1F446}\x{1F595}\x{1F447}\x{270C}\x{1F91E}\x{1F596}\x{1F918}\x{1F919}\x{1F590}\x{270B}\x{1F44C}\x{1F44D}\x{1F44E}\x{270A}\x{1F44A}\x{1F91B}\x{1F91C}\x{1F91A}\x{1F44B}\x{1F91F}\x{270D}\x{1F44F}\x{1F450}\x{1F64C}\x{1F932}\x{1F64F}\x{1F485}\x{1F442}\x{1F443}](?:\x{1F3FF})|[\x{1F476}\x{1F9D2}\x{1F466}\x{1F467}\x{1F9D1}\x{1F468}\x{1F469}\x{1F9D3}\x{1F474}\x{1F475}\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F934}\x{1F478}\x{1F473}\x{1F472}\x{1F9D5}\x{1F9D4}\x{1F471}\x{1F935}\x{1F470}\x{1F930}\x{1F931}\x{1F47C}\x{1F385}\x{1F936}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F483}\x{1F57A}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F6C0}\x{1F6CC}\x{1F574}\x{1F3C7}\x{1F3C2}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}\x{1F933}\x{1F4AA}\x{1F9B5}\x{1F9B6}\x{1F448}\x{1F449}\x{261D}\x{1F446}\x{1F595}\x{1F447}\x{270C}\x{1F91E}\x{1F596}\x{1F918}\x{1F919}\x{1F590}\x{270B}\x{1F44C}\x{1F44D}\x{1F44E}\x{270A}\x{1F44A}\x{1F91B}\x{1F91C}\x{1F91A}\x{1F44B}\x{1F91F}\x{270D}\x{1F44F}\x{1F450}\x{1F64C}\x{1F932}\x{1F64F}\x{1F485}\x{1F442}\x{1F443}](?:\x{1F3FE})|[\x{1F476}\x{1F9D2}\x{1F466}\x{1F467}\x{1F9D1}\x{1F468}\x{1F469}\x{1F9D3}\x{1F474}\x{1F475}\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F934}\x{1F478}\x{1F473}\x{1F472}\x{1F9D5}\x{1F9D4}\x{1F471}\x{1F935}\x{1F470}\x{1F930}\x{1F931}\x{1F47C}\x{1F385}\x{1F936}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F483}\x{1F57A}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F6C0}\x{1F6CC}\x{1F574}\x{1F3C7}\x{1F3C2}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}\x{1F933}\x{1F4AA}\x{1F9B5}\x{1F9B6}\x{1F448}\x{1F449}\x{261D}\x{1F446}\x{1F595}\x{1F447}\x{270C}\x{1F91E}\x{1F596}\x{1F918}\x{1F919}\x{1F590}\x{270B}\x{1F44C}\x{1F44D}\x{1F44E}\x{270A}\x{1F44A}\x{1F91B}\x{1F91C}\x{1F91A}\x{1F44B}\x{1F91F}\x{270D}\x{1F44F}\x{1F450}\x{1F64C}\x{1F932}\x{1F64F}\x{1F485}\x{1F442}\x{1F443}](?:\x{1F3FD})|[\x{1F476}\x{1F9D2}\x{1F466}\x{1F467}\x{1F9D1}\x{1F468}\x{1F469}\x{1F9D3}\x{1F474}\x{1F475}\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F934}\x{1F478}\x{1F473}\x{1F472}\x{1F9D5}\x{1F9D4}\x{1F471}\x{1F935}\x{1F470}\x{1F930}\x{1F931}\x{1F47C}\x{1F385}\x{1F936}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F483}\x{1F57A}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F6C0}\x{1F6CC}\x{1F574}\x{1F3C7}\x{1F3C2}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}\x{1F933}\x{1F4AA}\x{1F9B5}\x{1F9B6}\x{1F448}\x{1F449}\x{261D}\x{1F446}\x{1F595}\x{1F447}\x{270C}\x{1F91E}\x{1F596}\x{1F918}\x{1F919}\x{1F590}\x{270B}\x{1F44C}\x{1F44D}\x{1F44E}\x{270A}\x{1F44A}\x{1F91B}\x{1F91C}\x{1F91A}\x{1F44B}\x{1F91F}\x{270D}\x{1F44F}\x{1F450}\x{1F64C}\x{1F932}\x{1F64F}\x{1F485}\x{1F442}\x{1F443}](?:\x{1F3FC})|[\x{1F476}\x{1F9D2}\x{1F466}\x{1F467}\x{1F9D1}\x{1F468}\x{1F469}\x{1F9D3}\x{1F474}\x{1F475}\x{1F46E}\x{1F575}\x{1F482}\x{1F477}\x{1F934}\x{1F478}\x{1F473}\x{1F472}\x{1F9D5}\x{1F9D4}\x{1F471}\x{1F935}\x{1F470}\x{1F930}\x{1F931}\x{1F47C}\x{1F385}\x{1F936}\x{1F9D9}\x{1F9DA}\x{1F9DB}\x{1F9DC}\x{1F9DD}\x{1F64D}\x{1F64E}\x{1F645}\x{1F646}\x{1F481}\x{1F64B}\x{1F647}\x{1F926}\x{1F937}\x{1F486}\x{1F487}\x{1F6B6}\x{1F3C3}\x{1F483}\x{1F57A}\x{1F9D6}\x{1F9D7}\x{1F9D8}\x{1F6C0}\x{1F6CC}\x{1F574}\x{1F3C7}\x{1F3C2}\x{1F3CC}\x{1F3C4}\x{1F6A3}\x{1F3CA}\x{26F9}\x{1F3CB}\x{1F6B4}\x{1F6B5}\x{1F938}\x{1F93D}\x{1F93E}\x{1F939}\x{1F933}\x{1F4AA}\x{1F9B5}\x{1F9B6}\x{1F448}\x{1F449}\x{261D}\x{1F446}\x{1F595}\x{1F447}\x{270C}\x{1F91E}\x{1F596}\x{1F918}\x{1F919}\x{1F590}\x{270B}\x{1F44C}\x{1F44D}\x{1F44E}\x{270A}\x{1F44A}\x{1F91B}\x{1F91C}\x{1F91A}\x{1F44B}\x{1F91F}\x{270D}\x{1F44F}\x{1F450}\x{1F64C}\x{1F932}\x{1F64F}\x{1F485}\x{1F442}\x{1F443}](?:\x{1F3FB})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1E9}\x{1F1F0}\x{1F1F2}\x{1F1F3}\x{1F1F8}\x{1F1F9}\x{1F1FA}](?:\x{1F1FF})|[\x{1F1E7}\x{1F1E8}\x{1F1EC}\x{1F1F0}\x{1F1F1}\x{1F1F2}\x{1F1F5}\x{1F1F8}\x{1F1FA}](?:\x{1F1FE})|[\x{1F1E6}\x{1F1E8}\x{1F1F2}\x{1F1F8}](?:\x{1F1FD})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1EC}\x{1F1F0}\x{1F1F2}\x{1F1F5}\x{1F1F7}\x{1F1F9}\x{1F1FF}](?:\x{1F1FC})|[\x{1F1E7}\x{1F1E8}\x{1F1F1}\x{1F1F2}\x{1F1F8}\x{1F1F9}](?:\x{1F1FB})|[\x{1F1E6}\x{1F1E8}\x{1F1EA}\x{1F1EC}\x{1F1ED}\x{1F1F1}\x{1F1F2}\x{1F1F3}\x{1F1F7}\x{1F1FB}](?:\x{1F1FA})|[\x{1F1E6}\x{1F1E7}\x{1F1EA}\x{1F1EC}\x{1F1ED}\x{1F1EE}\x{1F1F1}\x{1F1F2}\x{1F1F5}\x{1F1F8}\x{1F1F9}\x{1F1FE}](?:\x{1F1F9})|[\x{1F1E6}\x{1F1E7}\x{1F1EA}\x{1F1EC}\x{1F1EE}\x{1F1F1}\x{1F1F2}\x{1F1F5}\x{1F1F7}\x{1F1F8}\x{1F1FA}\x{1F1FC}](?:\x{1F1F8})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1EA}\x{1F1EB}\x{1F1EC}\x{1F1ED}\x{1F1EE}\x{1F1F0}\x{1F1F1}\x{1F1F2}\x{1F1F3}\x{1F1F5}\x{1F1F8}\x{1F1F9}](?:\x{1F1F7})|[\x{1F1E6}\x{1F1E7}\x{1F1EC}\x{1F1EE}\x{1F1F2}](?:\x{1F1F6})|[\x{1F1E8}\x{1F1EC}\x{1F1EF}\x{1F1F0}\x{1F1F2}\x{1F1F3}](?:\x{1F1F5})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1E9}\x{1F1EB}\x{1F1EE}\x{1F1EF}\x{1F1F2}\x{1F1F3}\x{1F1F7}\x{1F1F8}\x{1F1F9}](?:\x{1F1F4})|[\x{1F1E7}\x{1F1E8}\x{1F1EC}\x{1F1ED}\x{1F1EE}\x{1F1F0}\x{1F1F2}\x{1F1F5}\x{1F1F8}\x{1F1F9}\x{1F1FA}\x{1F1FB}](?:\x{1F1F3})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1E9}\x{1F1EB}\x{1F1EC}\x{1F1ED}\x{1F1EE}\x{1F1EF}\x{1F1F0}\x{1F1F2}\x{1F1F4}\x{1F1F5}\x{1F1F8}\x{1F1F9}\x{1F1FA}\x{1F1FF}](?:\x{1F1F2})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1EC}\x{1F1EE}\x{1F1F2}\x{1F1F3}\x{1F1F5}\x{1F1F8}\x{1F1F9}](?:\x{1F1F1})|[\x{1F1E8}\x{1F1E9}\x{1F1EB}\x{1F1ED}\x{1F1F1}\x{1F1F2}\x{1F1F5}\x{1F1F8}\x{1F1F9}\x{1F1FD}](?:\x{1F1F0})|[\x{1F1E7}\x{1F1E9}\x{1F1EB}\x{1F1F8}\x{1F1F9}](?:\x{1F1EF})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1EB}\x{1F1EC}\x{1F1F0}\x{1F1F1}\x{1F1F3}\x{1F1F8}\x{1F1FB}](?:\x{1F1EE})|[\x{1F1E7}\x{1F1E8}\x{1F1EA}\x{1F1EC}\x{1F1F0}\x{1F1F2}\x{1F1F5}\x{1F1F8}\x{1F1F9}](?:\x{1F1ED})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1E9}\x{1F1EA}\x{1F1EC}\x{1F1F0}\x{1F1F2}\x{1F1F3}\x{1F1F5}\x{1F1F8}\x{1F1F9}\x{1F1FA}\x{1F1FB}](?:\x{1F1EC})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1EC}\x{1F1F2}\x{1F1F3}\x{1F1F5}\x{1F1F9}\x{1F1FC}](?:\x{1F1EB})|[\x{1F1E6}\x{1F1E7}\x{1F1E9}\x{1F1EA}\x{1F1EC}\x{1F1EE}\x{1F1EF}\x{1F1F0}\x{1F1F2}\x{1F1F3}\x{1F1F5}\x{1F1F7}\x{1F1F8}\x{1F1FB}\x{1F1FE}](?:\x{1F1EA})|[\x{1F1E6}\x{1F1E7}\x{1F1E8}\x{1F1EC}\x{1F1EE}\x{1F1F2}\x{1F1F8}\x{1F1F9}](?:\x{1F1E9})|[\x{1F1E6}\x{1F1E8}\x{1F1EA}\x{1F1EE}\x{1F1F1}\x{1F1F2}\x{1F1F3}\x{1F1F8}\x{1F1F9}\x{1F1FB}](?:\x{1F1E8})|[\x{1F1E7}\x{1F1EC}\x{1F1F1}\x{1F1F8}](?:\x{1F1E7})|[\x{1F1E7}\x{1F1E8}\x{1F1EA}\x{1F1EC}\x{1F1F1}\x{1F1F2}\x{1F1F3}\x{1F1F5}\x{1F1F6}\x{1F1F8}\x{1F1F9}\x{1F1FA}\x{1F1FB}\x{1F1FF}](?:\x{1F1E6})|[\x{00A9}\x{00AE}\x{203C}\x{2049}\x{2122}\x{2139}\x{2194}-\x{2199}\x{21A9}-\x{21AA}\x{231A}-\x{231B}\x{2328}\x{23CF}\x{23E9}-\x{23F3}\x{23F8}-\x{23FA}\x{24C2}\x{25AA}-\x{25AB}\x{25B6}\x{25C0}\x{25FB}-\x{25FE}\x{2600}-\x{2604}\x{260E}\x{2611}\x{2614}-\x{2615}\x{2618}\x{261D}\x{2620}\x{2622}-\x{2623}\x{2626}\x{262A}\x{262E}-\x{262F}\x{2638}-\x{263A}\x{2640}\x{2642}\x{2648}-\x{2653}\x{2660}\x{2663}\x{2665}-\x{2666}\x{2668}\x{267B}\x{267E}-\x{267F}\x{2692}-\x{2697}\x{2699}\x{269B}-\x{269C}\x{26A0}-\x{26A1}\x{26AA}-\x{26AB}\x{26B0}-\x{26B1}\x{26BD}-\x{26BE}\x{26C4}-\x{26C5}\x{26C8}\x{26CE}-\x{26CF}\x{26D1}\x{26D3}-\x{26D4}\x{26E9}-\x{26EA}\x{26F0}-\x{26F5}\x{26F7}-\x{26FA}\x{26FD}\x{2702}\x{2705}\x{2708}-\x{270D}\x{270F}\x{2712}\x{2714}\x{2716}\x{271D}\x{2721}\x{2728}\x{2733}-\x{2734}\x{2744}\x{2747}\x{274C}\x{274E}\x{2753}-\x{2755}\x{2757}\x{2763}-\x{2764}\x{2795}-\x{2797}\x{27A1}\x{27B0}\x{27BF}\x{2934}-\x{2935}\x{2B05}-\x{2B07}\x{2B1B}-\x{2B1C}\x{2B50}\x{2B55}\x{3030}\x{303D}\x{3297}\x{3299}\x{1F004}\x{1F0CF}\x{1F170}-\x{1F171}\x{1F17E}-\x{1F17F}\x{1F18E}\x{1F191}-\x{1F19A}\x{1F201}-\x{1F202}\x{1F21A}\x{1F22F}\x{1F232}-\x{1F23A}\x{1F250}-\x{1F251}\x{1F300}-\x{1F321}\x{1F324}-\x{1F393}\x{1F396}-\x{1F397}\x{1F399}-\x{1F39B}\x{1F39E}-\x{1F3F0}\x{1F3F3}-\x{1F3F5}\x{1F3F7}-\x{1F3FA}\x{1F400}-\x{1F4FD}\x{1F4FF}-\x{1F53D}\x{1F549}-\x{1F54E}\x{1F550}-\x{1F567}\x{1F56F}-\x{1F570}\x{1F573}-\x{1F57A}\x{1F587}\x{1F58A}-\x{1F58D}\x{1F590}\x{1F595}-\x{1F596}\x{1F5A4}-\x{1F5A5}\x{1F5A8}\x{1F5B1}-\x{1F5B2}\x{1F5BC}\x{1F5C2}-\x{1F5C4}\x{1F5D1}-\x{1F5D3}\x{1F5DC}-\x{1F5DE}\x{1F5E1}\x{1F5E3}\x{1F5E8}\x{1F5EF}\x{1F5F3}\x{1F5FA}-\x{1F64F}\x{1F680}-\x{1F6C5}\x{1F6CB}-\x{1F6D2}\x{1F6E0}-\x{1F6E5}\x{1F6E9}\x{1F6EB}-\x{1F6EC}\x{1F6F0}\x{1F6F3}-\x{1F6F9}\x{1F910}-\x{1F93A}\x{1F93C}-\x{1F93E}\x{1F940}-\x{1F945}\x{1F947}-\x{1F970}\x{1F973}-\x{1F976}\x{1F97A}\x{1F97C}-\x{1F9A2}\x{1F9B0}-\x{1F9B9}\x{1F9C0}-\x{1F9C2}\x{1F9D0}-\x{1F9FF}]` +) +``` + +```go +var ( + // KFile utilities + KFile LkkFile + + // KStr utilities + KStr LkkString + + // KNum utilities + KNum LkkNumber + + // KArr utilities + KArr LkkArray + + // KTime utilities + KTime LkkTime + + // KConv utilities + KConv LkkConvert + + // KOS utilities + KOS LkkOS + + // KEncr utilities + KEncr LkkEncrypt + + // KDbug utilities + KDbug LkkDebug + + // 已编译的正则 + RegFormatDir = regexp.MustCompile(`[\/]{2,}`) //连续的"//"或"\\"或"\/"或"/\" + RegChineseAll = regexp.MustCompile(PATTERN_CHINESE_ALL) + RegChineseName = regexp.MustCompile(PATTERN_CHINESE_NAME) + RegWord = regexp.MustCompile(PATTERN_WORD) + RegMultiByte = regexp.MustCompile(PATTERN_MULTIBYTE) + RegFullWidth = regexp.MustCompile(PATTERN_FULLWIDTH) + RegHalfWidth = regexp.MustCompile(PATTERN_HALFWIDTH) + RegFloat = regexp.MustCompile(PATTERN_FLOAT) + RegEmail = regexp.MustCompile(PATTERN_EMAIL) + RegMobilecn = regexp.MustCompile(PATTERN_MOBILECN) + RegTelephone = regexp.MustCompile(PATTERN_TELEPHONE) + RegPhone = regexp.MustCompile(PATTERN_PHONE) + RegDatetime = regexp.MustCompile(PATTERN_DATETIME) + RegCreditno = regexp.MustCompile(PATTERN_CREDIT_NO) + RegAlphaLower = regexp.MustCompile(PATTERN_ALPHA_LOWER) + RegAlphaUpper = regexp.MustCompile(PATTERN_ALPHA_UPPER) + RegAlphaNumeric = regexp.MustCompile(PATTERN_ALPHA_NUMERIC) + RegHexcolor = regexp.MustCompile(PATTERN_HEXCOLOR) + RegRgbcolor = regexp.MustCompile(PATTERN_RGBCOLOR) + RegWhitespace = regexp.MustCompile(`\s`) + RegWhitespaceAll = regexp.MustCompile(PATTERN_WHITESPACE_ALL) + RegWhitespaceHas = regexp.MustCompile(PATTERN_WHITESPACE_HAS) + RegWhitespaceDuplicate = regexp.MustCompile(PATTERN_WHITESPACE_DUPLICATE) + RegBase64 = regexp.MustCompile(PATTERN_BASE64) + RegBase64Image = regexp.MustCompile(PATTERN_BASE64_IMAGE) + RegHtmlTag = regexp.MustCompile(PATTERN_HTML_TAGS) + RegDNSname = regexp.MustCompile(PATTERN_DNSNAME) + RegUrlBackslashDuplicate = regexp.MustCompile(`([^:])[\/]{2,}`) //url中连续的"//"或"\\"或"\/"或"/\" + RegMd5 = regexp.MustCompile(PATTERN_MD5) + RegSha1 = regexp.MustCompile(PATTERN_SHA1) + RegSha256 = regexp.MustCompile(PATTERN_SHA256) + RegSha512 = regexp.MustCompile(PATTERN_SHA512) + RegEmoji = regexp.MustCompile(PATTERN_EMOJI) + RegUsernameen = regexp.MustCompile(PATTERN_USERNAMEEN) + RegEquation = regexp.MustCompile(PATTERN_EQUATION) + RegAscii = regexp.MustCompile(PATTERN_ASCII) +) +``` + +#### func CallFunc + +```go +func CallFunc(f interface{}, args ...interface{}) ([]interface{}, error) +``` +CallFunc 动态调用函数. + +#### func GetFieldValue + +```go +func GetFieldValue(arr interface{}, fieldName string) (res interface{}, err error) +``` +GetFieldValue 获取(字典/结构体的)字段值;fieldName为字段名,大小写敏感. + +#### func GetVariatePointerAddr + +```go +func GetVariatePointerAddr(val interface{}) int64 +``` +GetVariatePointerAddr 获取变量的指针地址. + +#### func GetVariateType + +```go +func GetVariateType(v interface{}) string +``` +GetVariateType 获取变量类型. + +#### func IsPointer + +```go +func IsPointer(val interface{}, notNil bool) (res bool) +``` +IsPointer 检查变量是否指针类型; notNil 是否检查变量非nil. + +#### func VerifyFunc + +```go +func VerifyFunc(f interface{}, args ...interface{}) (vf reflect.Value, vargs []reflect.Value, err error) +``` +VerifyFunc 验证是否函数,并且参数个数、类型是否正确. 返回有效的函数、有效的参数. + +#### type BiosInfo + +```go +type BiosInfo struct { + Vendor string `json:"vendor"` + Version string `json:"version"` + Date string `json:"date"` +} +``` + +BiosInfo BIOS信息 + +#### type BoardInfo + +```go +type BoardInfo struct { + Name string `json:"name"` + Vendor string `json:"vendor"` + Version string `json:"version"` + Serial string `json:"serial"` + AssetTag string `json:"assettag"` +} +``` + +BoardInfo Board信息 + +#### type CallBack + +```go +type CallBack func() +``` + +CallBack 回调执行函数,无参数且无返回值 + +#### type CpuInfo + +```go +type CpuInfo struct { + Vendor string `json:"vendor"` + Model string `json:"model"` + Speed string `json:"speed"` // CPU clock rate in MHz + Cache uint `json:"cache"` // CPU cache size in KB + Cpus uint `json:"cpus"` // number of physical CPUs + Cores uint `json:"cores"` // number of physical CPU cores + Threads uint `json:"threads"` // number of logical (HT) CPU cores +} +``` + +CpuInfo CPU信息 + +#### type FileFilter + +```go +type FileFilter func(string) bool +``` + +FileFilter 文件过滤函数 + +#### type LkkArrCompareType + +```go +type LkkArrCompareType uint8 +``` + +LkkArrCompareType 枚举类型,数组比较方式 + +#### type LkkArray + +```go +type LkkArray struct { +} +``` + +LkkArray is the receiver of array utilities + +#### func (*LkkArray) ArrayChunk + +```go +func (ka *LkkArray) ArrayChunk(arr interface{}, size int) [][]interface{} +``` +ArrayChunk 将一个数组/切片分割成多个,size为每个子数组的长度. + +#### func (*LkkArray) ArrayColumn + +```go +func (ka *LkkArray) ArrayColumn(arr interface{}, columnKey string) []interface{} +``` +ArrayColumn 返回数组(切片/字典/结构体)中元素指定的一列. arr的元素必须是字典; columnKey为元素的字段名; 该方法效率较低. + +#### func (*LkkArray) ArrayDiff + +```go +func (ka *LkkArray) ArrayDiff(arr1, arr2 interface{}, compareType LkkArrCompareType) map[interface{}]interface{} +``` +ArrayDiff 计算数组(数组/切片/字典)的差集,返回在 arr1 中但不在 arr2 里的元素,注意会同时返回键. +compareType为两个数组的比较方式,枚举类型,有: COMPARE_ONLY_VALUE 根据元素值比较, 返回在 arr1 中但是不在arr2 +里的值; COMPARE_ONLY_KEY 根据 arr1 中的键名和 arr2 进行比较,返回不同键名的项; COMPARE_BOTH_KEYVALUE +同时比较键和值. + +#### func (*LkkArray) ArrayFlip + +```go +func (ka *LkkArray) ArrayFlip(arr interface{}) map[interface{}]interface{} +``` +ArrayFlip 交换数组(切片/字典)中的键和值. + +#### func (*LkkArray) ArrayIntersect + +```go +func (ka *LkkArray) ArrayIntersect(arr1, arr2 interface{}, compareType LkkArrCompareType) map[interface{}]interface{} +``` +ArrayIntersect 计算数组(数组/切片/字典)的交集,返回在 arr1 中且在 arr2 里的元素,注意会同时返回键. +compareType为两个数组的比较方式,枚举类型,有: COMPARE_ONLY_VALUE 根据元素值比较, 返回在 arr1 中且在arr2 里的值; +COMPARE_ONLY_KEY 根据 arr1 中的键名和 arr2 进行比较,返回相同键名的项; COMPARE_BOTH_KEYVALUE +同时比较键和值. + +#### func (*LkkArray) ArrayKeyExists + +```go +func (ka *LkkArray) ArrayKeyExists(key interface{}, arr interface{}) bool +``` +ArrayKeyExists 检查arr(数组/切片/字典/结构体)里是否有key指定的键名(索引/字段). + +#### func (*LkkArray) ArrayKeys + +```go +func (ka *LkkArray) ArrayKeys(arr interface{}) []interface{} +``` +ArrayKeys 返回数组(切片/字典/结构体)中所有的键名;如果是结构体,只返回公开的字段. + +#### func (*LkkArray) ArrayPad + +```go +func (ka *LkkArray) ArrayPad(arr interface{}, size int, item interface{}) []interface{} +``` +ArrayPad 以指定长度将一个值item填充进arr数组/切片. 若 size 为正,则填补到数组的右侧,如果为负则从左侧开始填补; 若 size +的绝对值小于或等于 arr 数组的长度则没有任何填补. + +#### func (*LkkArray) ArrayRand + +```go +func (ka *LkkArray) ArrayRand(arr interface{}, num int) []interface{} +``` +ArrayRand 从数组(切片/字典)中随机取出num个元素. + +#### func (*LkkArray) ArrayReverse + +```go +func (ka *LkkArray) ArrayReverse(arr interface{}) []interface{} +``` +ArrayReverse 返回单元顺序相反的数组(仅限数组和切片). + +#### func (*LkkArray) ArraySearchItem + +```go +func (ka *LkkArray) ArraySearchItem(arr interface{}, condition map[string]interface{}) (res interface{}) +``` +ArraySearchItem 从数组(切片/字典)中搜索对应元素(单个). arr为要查找的数组,元素必须为字典/结构体;condition为条件字典. + +#### func (*LkkArray) ArraySearchMutil + +```go +func (ka *LkkArray) ArraySearchMutil(arr interface{}, condition map[string]interface{}) (res []interface{}) +``` +ArraySearchMutil 从数组(切片/字典)中搜索对应元素(多个). arr为要查找的数组,元素必须为字典/结构体;condition为条件字典. + +#### func (*LkkArray) ArrayShuffle + +```go +func (ka *LkkArray) ArrayShuffle(arr interface{}) []interface{} +``` +ArrayShuffle 打乱数组/切片排序. + +#### func (*LkkArray) ArrayUnique + +```go +func (ka *LkkArray) ArrayUnique(arr interface{}) map[interface{}]interface{} +``` +ArrayUnique 移除数组(切片/字典)中重复的值,返回字典,保留键名. + +#### func (*LkkArray) ArrayValues + +```go +func (ka *LkkArray) ArrayValues(arr interface{}, filterZero bool) []interface{} +``` +ArrayValues 返回arr(数组/切片/字典/结构体)中所有的值;如果是结构体,只返回公开字段的值. filterZero +是否过滤零值元素(nil,false,0,"",[]),true时排除零值元素,false时保留零值元素. + +#### func (*LkkArray) CopyStruct + +```go +func (ka *LkkArray) CopyStruct(dest interface{}, resources ...interface{}) interface{} +``` +CopyStruct 将resources的值拷贝到dest目标结构体; +要求dest必须是结构体指针,resources为多个源结构体;若resources存在多个相同字段的元素,结果以最后的为准; +只简单核对字段名,无错误处理,需开发自行检查dest和resources字段类型才可操作. + +#### func (*LkkArray) CutSlice + +```go +func (ka *LkkArray) CutSlice(arr interface{}, offset, size int) []interface{} +``` +CutSlice 裁剪切片,返回根据offset(起始位置)和size(数量)参数所指定的arr(数组/切片)中的一段切片. + +#### func (*LkkArray) DeleteSliceItems + +```go +func (ka *LkkArray) DeleteSliceItems(val interface{}, ids ...int) (res []interface{}, del int) +``` +DeleteSliceItems 删除数组/切片的元素,返回一个新切片. ids为多个元素的索引(0~len(val)-1); del为删除元素的数量. + +#### func (*LkkArray) Implode + +```go +func (ka *LkkArray) Implode(delimiter string, arr interface{}) string +``` +Implode 用delimiter将数组(数组/切片/字典/结构体)的值连接为一个字符串. + +#### func (*LkkArray) InArray + +```go +func (ka *LkkArray) InArray(needle interface{}, haystack interface{}) bool +``` +InArray 元素needle是否在数组haystack(切片/字典)内. + +#### func (*LkkArray) InInt64Slice + +```go +func (ka *LkkArray) InInt64Slice(i int64, list []int64) bool +``` +InInt64Slice 是否在64位整型切片内. + +#### func (*LkkArray) InIntSlice + +```go +func (ka *LkkArray) InIntSlice(i int, list []int) bool +``` +InIntSlice 是否在整型切片内. + +#### func (*LkkArray) InStringSlice + +```go +func (ka *LkkArray) InStringSlice(str string, list []string) bool +``` +InStringSlice 是否在字符串切片内. + +#### func (*LkkArray) IsArray + +```go +func (ka *LkkArray) IsArray(val interface{}) bool +``` +IsArray 变量是否数组. + +#### func (*LkkArray) IsArrayOrSlice + +```go +func (ka *LkkArray) IsArrayOrSlice(val interface{}) bool +``` +IsArrayOrSlice 变量是否数组或切片. + +#### func (*LkkArray) IsEqualArray + +```go +func (ka *LkkArray) IsEqualArray(arr1, arr2 interface{}) bool +``` +IsEqualArray 两个数组/切片是否相同(不管元素顺序),且不会检查元素类型; arr1, arr2 是要比较的数组/切片. + +#### func (*LkkArray) IsEqualMap + +```go +func (ka *LkkArray) IsEqualMap(arr1, arr2 interface{}) bool +``` +IsEqualMap 两个字典是否相同(不管键顺序),且不会严格检查元素类型; arr1, arr2 是要比较的字典. + +#### func (*LkkArray) IsMap + +```go +func (ka *LkkArray) IsMap(val interface{}) bool +``` +IsMap 变量是否字典. + +#### func (*LkkArray) IsSlice + +```go +func (ka *LkkArray) IsSlice(val interface{}) bool +``` +IsSlice 变量是否切片. + +#### func (*LkkArray) IsStruct + +```go +func (ka *LkkArray) IsStruct(val interface{}) bool +``` +IsStruct 变量是否结构体. + +#### func (*LkkArray) JoinInts + +```go +func (ka *LkkArray) JoinInts(delimiter string, ints []int) (res string) +``` +JoinInts 使用分隔符delimiter连接整数切片. + +#### func (*LkkArray) JoinStrings + +```go +func (ka *LkkArray) JoinStrings(delimiter string, strs []string) (res string) +``` +JoinStrings 使用分隔符delimiter连接字符串切片strs.效率比Implode高. + +#### func (*LkkArray) Length + +```go +func (ka *LkkArray) Length(val interface{}) int +``` +Length 获取数组/切片的长度;结果为-1表示变量不是数组或切片. + +#### func (*LkkArray) MergeMap + +```go +func (ka *LkkArray) MergeMap(ss ...interface{}) map[interface{}]interface{} +``` +MergeMap 合并字典,相同的键名时,后面的值将覆盖前一个值. ss是元素为字典的切片. + +#### func (*LkkArray) MergeSlice + +```go +func (ka *LkkArray) MergeSlice(filterZero bool, ss ...interface{}) []interface{} +``` +MergeSlice 合并一个或多个数组/切片. filterZero +是否过滤零值元素(nil,false,0,”,[]),true时排除零值元素,false时保留零值元素. ss是元素为数组/切片的切片. + +#### func (*LkkArray) NewStrMapItf + +```go +func (ka *LkkArray) NewStrMapItf() map[string]interface{} +``` +NewStrMapItf 新建[字符-接口]字典. + +#### func (*LkkArray) NewStrMapStr + +```go +func (ka *LkkArray) NewStrMapStr() map[string]string +``` +NewStrMapStr 新建[字符-字符]字典. + +#### func (*LkkArray) SliceFill + +```go +func (ka *LkkArray) SliceFill(val interface{}, num int) []interface{} +``` +SliceFill 用给定的值val填充切片,num为插入元素的数量. + +#### func (*LkkArray) SlicePop + +```go +func (ka *LkkArray) SlicePop(s *[]interface{}) interface{} +``` +SlicePop 弹出切片最后一个元素(出栈),并返回该元素. + +#### func (*LkkArray) SlicePush + +```go +func (ka *LkkArray) SlicePush(s *[]interface{}, elements ...interface{}) int +``` +SlicePush 将一个或多个元素压入切片的末尾(入栈),返回处理之后切片的元素个数. + +#### func (*LkkArray) SliceShift + +```go +func (ka *LkkArray) SliceShift(s *[]interface{}) interface{} +``` +SliceShift 将切片开头的元素移出,并返回该元素. + +#### func (*LkkArray) SliceUnshift + +```go +func (ka *LkkArray) SliceUnshift(s *[]interface{}, elements ...interface{}) int +``` +SliceUnshift 在切片开头插入一个或多个元素,返回处理之后切片的元素个数. + +#### func (*LkkArray) Unique64Ints + +```go +func (ka *LkkArray) Unique64Ints(ints []int64) (res []int64) +``` +Unique64Ints 移除64位整数切片中的重复值. + +#### func (*LkkArray) UniqueInts + +```go +func (ka *LkkArray) UniqueInts(ints []int) (res []int) +``` +UniqueInts 移除整数切片中的重复值. + +#### func (*LkkArray) UniqueStrings + +```go +func (ka *LkkArray) UniqueStrings(strs []string) (res []string) +``` +UniqueStrings 移除字符串切片中的重复值. + +#### type LkkCaseSwitch + +```go +type LkkCaseSwitch uint8 +``` + +LkkCaseSwitch 枚举类型,大小写开关 + +#### type LkkConvert + +```go +type LkkConvert struct { +} +``` + +LkkConvert is the receiver of convert utilities + +#### func (*LkkConvert) BaseConvert + +```go +func (kc *LkkConvert) BaseConvert(num string, frombase, tobase int) (string, error) +``` +BaseConvert 进制转换,在任意进制之间转换数字. num为输入数值,frombase为原进制,tobase为结果进制. + +#### func (*LkkConvert) Bin2Dec + +```go +func (kc *LkkConvert) Bin2Dec(str string) (int64, error) +``` +Bin2Dec 将二进制字符串转换为十进制. + +#### func (*LkkConvert) Bin2Hex + +```go +func (kc *LkkConvert) Bin2Hex(str string) (string, error) +``` +Bin2Hex 将二进制字符串转换为十六进制字符串. + +#### func (*LkkConvert) Bool2Int + +```go +func (kc *LkkConvert) Bool2Int(val bool) int +``` +Bool2Int 将布尔值转换为整型. + +#### func (*LkkConvert) Bool2Str + +```go +func (kc *LkkConvert) Bool2Str(val bool) string +``` +Bool2Str 将布尔值转换为字符串. + +#### func (*LkkConvert) Byte2Float64 + +```go +func (kc *LkkConvert) Byte2Float64(bytes []byte) float64 +``` +Byte2Float64 字节切片转64位浮点数. + +#### func (*LkkConvert) Byte2Hex + +```go +func (kc *LkkConvert) Byte2Hex(val []byte) string +``` +Byte2Hex 字节切片转16进制字符串. + +#### func (*LkkConvert) Byte2Hexs + +```go +func (kc *LkkConvert) Byte2Hexs(val []byte) []byte +``` +Byte2Hexs 字节切片转16进制切片. + +#### func (*LkkConvert) Byte2Int64 + +```go +func (kc *LkkConvert) Byte2Int64(val []byte) int64 +``` +Byte2Int64 字节切片转64位整型. + +#### func (*LkkConvert) Bytes2Str + +```go +func (kc *LkkConvert) Bytes2Str(val []byte) string +``` +Bytes2Str 将字节切片转换为字符串. + +#### func (*LkkConvert) Bytes2StrUnsafe + +```go +func (kc *LkkConvert) Bytes2StrUnsafe(val []byte) string +``` +Bytes2StrUnsafe (非安全的)将字节切片转换为字符串. +零拷贝,不安全.效率是string([]byte{})的百倍以上,且转换量越大效率优势越明显. + +#### func (*LkkConvert) Dec2Bin + +```go +func (kc *LkkConvert) Dec2Bin(num int64) string +``` +Dec2Bin 将十进制转换为二进制字符串. + +#### func (*LkkConvert) Dec2Hex + +```go +func (kc *LkkConvert) Dec2Hex(num int64) string +``` +Dec2Hex 将十进制转换为十六进制. + +#### func (*LkkConvert) Dec2Oct + +```go +func (kc *LkkConvert) Dec2Oct(num int64) string +``` +Dec2Oct 将十进制转换为八进制. + +#### func (*LkkConvert) Float2Str + +```go +func (kc *LkkConvert) Float2Str(val interface{}, decimal int) string +``` +Float2Str 将浮点数转换为字符串,decimal为小数位数. + +#### func (*LkkConvert) Float64ToByte + +```go +func (kc *LkkConvert) Float64ToByte(val float64) []byte +``` +Float64ToByte 64位浮点数转字节切片. + +#### func (*LkkConvert) Hex2Bin + +```go +func (kc *LkkConvert) Hex2Bin(str string) (string, error) +``` +Hex2Bin 将十六进制字符串转换为二进制字符串. + +#### func (*LkkConvert) Hex2Byte + +```go +func (kc *LkkConvert) Hex2Byte(str string) []byte +``` +Hex2Byte 16进制字符串转字节切片. + +#### func (*LkkConvert) Hex2Dec + +```go +func (kc *LkkConvert) Hex2Dec(str string) (int64, error) +``` +Hex2Dec 将十六进制转换为十进制. + +#### func (*LkkConvert) Hexs2Byte + +```go +func (kc *LkkConvert) Hexs2Byte(val []byte) []byte +``` +Hexs2Byte 16进制切片转byte切片. + +#### func (*LkkConvert) Int2Str + +```go +func (kc *LkkConvert) Int2Str(val interface{}) string +``` +Int2Str 将整数转换为字符串. + +#### func (*LkkConvert) Int64ToByte + +```go +func (kc *LkkConvert) Int64ToByte(val int64) []byte +``` +Int64ToByte 64位整型转字节切片. + +#### func (*LkkConvert) Ip2Long + +```go +func (kc *LkkConvert) Ip2Long(ipAddress string) uint32 +``` +Ip2Long 将 IPV4 的字符串互联网协议转换成长整型数字. + +#### func (*LkkConvert) IsBinary + +```go +func (kc *LkkConvert) IsBinary(s string) bool +``` +IsBinary 字符串是否二进制. + +#### func (*LkkConvert) IsBool + +```go +func (kc *LkkConvert) IsBool(val interface{}) bool +``` +IsBool 是否布尔值. + +#### func (*LkkConvert) IsByte + +```go +func (kc *LkkConvert) IsByte(val interface{}) bool +``` +IsByte 变量是否字节切片. + +#### func (*LkkConvert) IsEmpty + +```go +func (kc *LkkConvert) IsEmpty(val interface{}) bool +``` +IsEmpty 变量是否为空. + +#### func (*LkkConvert) IsFloat + +```go +func (kc *LkkConvert) IsFloat(val interface{}) bool +``` +IsFloat 变量是否浮点数值. + +#### func (*LkkConvert) IsHex + +```go +func (kc *LkkConvert) IsHex(str string) bool +``` +IsHex 是否十六进制字符串. + +#### func (*LkkConvert) IsInt + +```go +func (kc *LkkConvert) IsInt(val interface{}) bool +``` +IsInt 变量是否整型数值. + +#### func (*LkkConvert) IsInterface + +```go +func (kc *LkkConvert) IsInterface(val interface{}) bool +``` +IsInterface 变量是否接口. + +#### func (*LkkConvert) IsNil + +```go +func (kc *LkkConvert) IsNil(val interface{}) bool +``` +IsNil 变量是否nil. + +#### func (*LkkConvert) IsNumeric + +```go +func (kc *LkkConvert) IsNumeric(val interface{}) bool +``` +IsNumeric 变量是否数值(不包含复数和科学计数法). + +#### func (*LkkConvert) IsPort + +```go +func (kc *LkkConvert) IsPort(val interface{}) bool +``` +IsPort 变量值是否端口号(1~65535). + +#### func (*LkkConvert) IsString + +```go +func (kc *LkkConvert) IsString(val interface{}) bool +``` +IsString 变量是否字符串. + +#### func (*LkkConvert) IsStruct + +```go +func (kc *LkkConvert) IsStruct(val interface{}) bool +``` +IsStruct 变量是否结构体. + +#### func (*LkkConvert) Long2Ip + +```go +func (kc *LkkConvert) Long2Ip(properAddress uint32) string +``` +Long2Ip 将长整型转化为字符串形式带点的互联网标准格式地址(IPV4). + +#### func (*LkkConvert) Oct2Dec + +```go +func (kc *LkkConvert) Oct2Dec(str string) (int64, error) +``` +Oct2Dec 将八进制转换为十进制. + +#### func (*LkkConvert) Runes2Bytes + +```go +func (kc *LkkConvert) Runes2Bytes(rs []rune) []byte +``` +Runes2Bytes 将[]rune转为[]byte. + +#### func (*LkkConvert) Str2Bool + +```go +func (kc *LkkConvert) Str2Bool(val string) bool +``` +Str2Bool 将字符串转换为布尔值. 1, t, T, TRUE, true, True 等字符串为真; 0, f, F, FALSE, false, +False 等字符串为假. + +#### func (*LkkConvert) Str2Bytes + +```go +func (kc *LkkConvert) Str2Bytes(val string) []byte +``` +Str2Bytes 将字符串转换为字节切片. + +#### func (*LkkConvert) Str2BytesUnsafe + +```go +func (kc *LkkConvert) Str2BytesUnsafe(val string) []byte +``` +Str2BytesUnsafe (非安全的)将字符串转换为字节切片. 该方法零拷贝,但不安全.它直接转换底层指针,两者指向的相同的内存,改一个另外一个也会变. +仅当临时需将长字符串转换且不长时间保存时可以使用. 转换之后若没做其他操作直接改变里面的字符,则程序会崩溃. 如 +b:=Str2BytesUnsafe("xxx"); b[1]='d'; 程序将panic. + +#### func (*LkkConvert) Str2Float32 + +```go +func (kc *LkkConvert) Str2Float32(val string) float32 +``` +Str2Float32 将字符串转换为float32;其中"true", "TRUE", "True"为1.0 . + +#### func (*LkkConvert) Str2Float64 + +```go +func (kc *LkkConvert) Str2Float64(val string) float64 +``` +Str2Float64 将字符串转换为float64;其中"true", "TRUE", "True"为1.0 . + +#### func (*LkkConvert) Str2Int + +```go +func (kc *LkkConvert) Str2Int(val string) int +``` +Str2Int 将字符串转换为int.其中"true", "TRUE", "True"为1;若为浮点字符串,则取整数部分. + +#### func (*LkkConvert) Str2Int16 + +```go +func (kc *LkkConvert) Str2Int16(val string) int16 +``` +Str2Int16 将字符串转换为int16. + +#### func (*LkkConvert) Str2Int32 + +```go +func (kc *LkkConvert) Str2Int32(val string) int32 +``` +Str2Int32 将字符串转换为int32. + +#### func (*LkkConvert) Str2Int64 + +```go +func (kc *LkkConvert) Str2Int64(val string) int64 +``` +Str2Int64 将字符串转换为int64. + +#### func (*LkkConvert) Str2Int8 + +```go +func (kc *LkkConvert) Str2Int8(val string) int8 +``` +Str2Int8 将字符串转换为int8. + +#### func (*LkkConvert) Str2Uint + +```go +func (kc *LkkConvert) Str2Uint(val string) uint +``` +Str2Uint 将字符串转换为uint.其中"true", "TRUE", "True"为1;若为浮点字符串,则取整数部分;若为负值则取0. + +#### func (*LkkConvert) Str2Uint16 + +```go +func (kc *LkkConvert) Str2Uint16(val string) uint16 +``` +Str2Uint16 将字符串转换为uint16. + +#### func (*LkkConvert) Str2Uint32 + +```go +func (kc *LkkConvert) Str2Uint32(val string) uint32 +``` +Str2Uint32 将字符串转换为uint32. + +#### func (*LkkConvert) Str2Uint64 + +```go +func (kc *LkkConvert) Str2Uint64(val string) uint64 +``` +Str2Uint64 将字符串转换为uint64. + +#### func (*LkkConvert) Str2Uint8 + +```go +func (kc *LkkConvert) Str2Uint8(val string) uint8 +``` +Str2Uint8 将字符串转换为uint8. + +#### func (*LkkConvert) Struct2Map + +```go +func (kc *LkkConvert) Struct2Map(obj interface{}, tagName string) (map[string]interface{}, error) +``` +Struct2Map 结构体转为字典;tagName为要导出的标签名,可以为空,为空时将导出所有字段. + +#### func (*LkkConvert) ToBool + +```go +func (kc *LkkConvert) ToBool(val interface{}) bool +``` +ToBool 强制将变量转换为布尔值. 数值类型将检查值是否>0; 字符串将使用Str2Bool; 数组、切片、字典、通道类型将检查它们的长度是否>0; +指针、结构体类型为true,其他为false. + +#### func (*LkkConvert) ToFloat + +```go +func (kc *LkkConvert) ToFloat(val interface{}) (res float64) +``` +ToFloat 强制将变量转换为浮点型. 数值类型将转为浮点型; 字符串将使用Str2Float64; 布尔型的true为1.0,false为0; +数组、切片、字典、通道类型将取它们的长度; 指针、结构体类型为1.0,其他为0. + +#### func (*LkkConvert) ToInt + +```go +func (kc *LkkConvert) ToInt(val interface{}) int +``` +ToInt 强制将变量转换为整型. 数值类型将转为整型; 字符串类型将使用Str2Int; 布尔型的true为1,false为0; +数组、切片、字典、通道类型将取它们的长度; 指针、结构体类型为1,其他为0. + +#### func (*LkkConvert) ToInterfaces + +```go +func (kc *LkkConvert) ToInterfaces(val interface{}) []interface{} +``` +ToInterfaces 强制将变量转为接口切片;和KArr.ArrayValues相同. 其中val类型必须是数组/切片/字典/结构体. + +#### func (*LkkConvert) ToStr + +```go +func (kc *LkkConvert) ToStr(val interface{}) string +``` +ToStr 强制将变量转换为字符串. + +#### type LkkDebug + +```go +type LkkDebug struct { +} +``` + +LkkDebug is the receiver of debug utilities + +#### func (*LkkDebug) CallMethod + +```go +func (kd *LkkDebug) CallMethod(t interface{}, method string, args ...interface{}) ([]interface{}, error) +``` +CallMethod 调用对象t的method方法. 若执行成功,则结果是该方法的返回结果; 否则返回(nil, error). + +#### func (*LkkDebug) DumpPrint + +```go +func (kd *LkkDebug) DumpPrint(vs ...interface{}) +``` +DumpPrint 打印调试变量. + +#### func (*LkkDebug) DumpStacks + +```go +func (kd *LkkDebug) DumpStacks() +``` +DumpStacks 打印堆栈信息. + +#### func (*LkkDebug) GetCallDir + +```go +func (kd *LkkDebug) GetCallDir() string +``` +GetCallDir 获取调用方法的文件目录. + +#### func (*LkkDebug) GetCallFile + +```go +func (kd *LkkDebug) GetCallFile() string +``` +GetCallFile 获取调用方法的文件路径. + +#### func (*LkkDebug) GetCallLine + +```go +func (kd *LkkDebug) GetCallLine() int +``` +GetCallLine 获取调用方法的行号. + +#### func (*LkkDebug) GetCallName + +```go +func (kd *LkkDebug) GetCallName(f interface{}, onlyFun bool) string +``` +GetCallName 获取调用的方法名称;f为目标方法;onlyFun为true时仅返回方法,不包括包名. + +#### func (*LkkDebug) GetCallPackage + +```go +func (kd *LkkDebug) GetCallPackage(callFile ...string) string +``` +GetCallPackage 获取调用方法或调用文件的包名.callFile为调用文件路径. + +#### func (*LkkDebug) GetFuncNames + +```go +func (kd *LkkDebug) GetFuncNames(obj interface{}) (res []string) +``` +GetFuncNames 获取变量的所有(公开的)函数名. + +#### func (*LkkDebug) GetMethod + +```go +func (kd *LkkDebug) GetMethod(t interface{}, method string) interface{} +``` +GetMethod 获取对象t中的method方法. 注意:返回的方法中的第一个参数是接收者. 所以,调用返回的方法时,必须将接收者作为第一个参数传递. + +#### func (*LkkDebug) HasMethod + +```go +func (kd *LkkDebug) HasMethod(t interface{}, method string) bool +``` +HasMethod 检查对象t是否具有method方法. + +#### func (*LkkDebug) Stacks + +```go +func (kd *LkkDebug) Stacks(skip int) []byte +``` +Stacks 获取堆栈信息;skip为要跳过的帧数. + +#### func (*LkkDebug) WrapError + +```go +func (kd *LkkDebug) WrapError(err error, args ...interface{}) (res error) +``` +WrapError 错误包裹. + +#### type LkkEncrypt + +```go +type LkkEncrypt struct { +} +``` + +LkkEncrypt is the receiver of encrypt utilities + +#### func (*LkkEncrypt) AesCBCDecrypt + +```go +func (ke *LkkEncrypt) AesCBCDecrypt(cipherText, key []byte, paddingType ...LkkPKCSType) ([]byte, error) +``` +AesCBCDecrypt AES-CBC密码分组链接(Cipher-block chaining)模式解密. +cipherText为密文;key为密钥,长16/24/32;paddingType为填充方式,枚举(PKCS_NONE,PKCS_ZERO,PKCS_SEVEN),默认PKCS_SEVEN. + +#### func (*LkkEncrypt) AesCBCEncrypt + +```go +func (ke *LkkEncrypt) AesCBCEncrypt(clearText, key []byte, paddingType ...LkkPKCSType) ([]byte, error) +``` +AesCBCEncrypt AES-CBC密码分组链接(Cipher-block chaining)模式加密.加密无法并行,不适合对流数据加密. +clearText为明文;key为密钥,长16/24/32;paddingType为填充方式,枚举(PKCS_ZERO,PKCS_SEVEN),默认PKCS_SEVEN. + +#### func (*LkkEncrypt) AesCFBDecrypt + +```go +func (ke *LkkEncrypt) AesCFBDecrypt(cipherText, key []byte) ([]byte, error) +``` +AesCFBDecrypt AES-CFB密文反馈(Cipher feedback)模式解密. cipherText为密文;key为密钥,长16/24/32. + +#### func (*LkkEncrypt) AesCFBEncrypt + +```go +func (ke *LkkEncrypt) AesCFBEncrypt(clearText, key []byte) ([]byte, error) +``` +AesCFBEncrypt AES-CFB密文反馈(Cipher feedback)模式加密.适合对流数据加密. +clearText为明文;key为密钥,长16/24/32. + +#### func (*LkkEncrypt) AesCTRDecrypt + +```go +func (ke *LkkEncrypt) AesCTRDecrypt(cipherText, key []byte) ([]byte, error) +``` +AesCTRDecrypt AES-CTR计算器(Counter)模式解密. cipherText为密文;key为密钥,长16/24/32. + +#### func (*LkkEncrypt) AesCTREncrypt + +```go +func (ke *LkkEncrypt) AesCTREncrypt(clearText, key []byte) ([]byte, error) +``` +AesCTREncrypt AES-CTR计算器(Counter)模式加密. clearText为明文;key为密钥,长16/24/32. + +#### func (*LkkEncrypt) AesOFBDecrypt + +```go +func (ke *LkkEncrypt) AesOFBDecrypt(cipherText, key []byte) ([]byte, error) +``` +AesOFBDecrypt AES-OFB输出反馈(Output feedback)模式解密. cipherText为密文;key为密钥,长16/24/32. + +#### func (*LkkEncrypt) AesOFBEncrypt + +```go +func (ke *LkkEncrypt) AesOFBEncrypt(clearText, key []byte) ([]byte, error) +``` +AesOFBEncrypt AES-OFB输出反馈(Output feedback)模式加密.适合对流数据加密. +clearText为明文;key为密钥,长16/24/32. + +#### func (*LkkEncrypt) AuthCode + +```go +func (ke *LkkEncrypt) AuthCode(str, key []byte, encode bool, expiry int64) ([]byte, int64) +``` +AuthCode 授权码编码或解码; encode为true时编码,为false解码; expiry为加密时的有效期,单位秒,为0时代表永久(100年); +返回结果为加密/解密的字符串和有效期时间戳. + +#### func (*LkkEncrypt) Base64Decode + +```go +func (ke *LkkEncrypt) Base64Decode(str []byte) ([]byte, error) +``` +Base64Decode 对使用 MIME base64 编码的数据进行解码. + +#### func (*LkkEncrypt) Base64Encode + +```go +func (ke *LkkEncrypt) Base64Encode(str []byte) []byte +``` +Base64Encode 使用 MIME base64 对数据进行编码. + +#### func (*LkkEncrypt) Base64UrlDecode + +```go +func (ke *LkkEncrypt) Base64UrlDecode(str []byte) ([]byte, error) +``` +Base64UrlDecode url安全的Base64Decode. + +#### func (*LkkEncrypt) Base64UrlEncode + +```go +func (ke *LkkEncrypt) Base64UrlEncode(str []byte) []byte +``` +Base64UrlEncode url安全的Base64Encode,没有'/'和'+'及结尾的'=' . + +#### func (*LkkEncrypt) EasyDecrypt + +```go +func (ke *LkkEncrypt) EasyDecrypt(val, key []byte) []byte +``` +EasyDecrypt 简单解密. val为待解密的字符串,key为密钥. + +#### func (*LkkEncrypt) EasyEncrypt + +```go +func (ke *LkkEncrypt) EasyEncrypt(data, key []byte) []byte +``` +EasyEncrypt 简单加密. data为要加密的原字符串,key为密钥. + +#### func (*LkkEncrypt) GenerateRsaKeys + +```go +func (ke *LkkEncrypt) GenerateRsaKeys(bits int) (private []byte, public []byte, err error) +``` +GenerateRsaKeys 生成RSA密钥对.bits为密钥位数,必须是64的倍数,范围为512-65536,通常为1024或2048. + +#### func (*LkkEncrypt) HmacShaX + +```go +func (ke *LkkEncrypt) HmacShaX(data, secret []byte, x uint16) []byte +``` +HmacShaX HmacSHA-x加密,x为1/256/512 . + +#### func (*LkkEncrypt) PasswordHash + +```go +func (ke *LkkEncrypt) PasswordHash(password []byte, costs ...int) ([]byte, error) +``` +PasswordHash 创建密码的散列值;costs为算法的cost,范围4~31,默认10;注意:值越大越耗时. + +#### func (*LkkEncrypt) PasswordVerify + +```go +func (ke *LkkEncrypt) PasswordVerify(password, hash []byte) bool +``` +PasswordVerify 验证密码是否和散列值匹配. + +#### func (*LkkEncrypt) RsaPrivateDecrypt + +```go +func (ke *LkkEncrypt) RsaPrivateDecrypt(cipherText, privateKey []byte) ([]byte, error) +``` +RsaPrivateDecrypt RSA私钥解密.比加密耗时. cipherText为密文,privateKey为私钥. + +#### func (*LkkEncrypt) RsaPrivateDecryptLong + +```go +func (ke *LkkEncrypt) RsaPrivateDecryptLong(cipherText, privateKey []byte) ([]byte, error) +``` +RsaPrivateDecryptLong RSA私钥解密长文本.比加密耗时. cipherText为密文,privateKey为私钥. + +#### func (*LkkEncrypt) RsaPrivateEncrypt + +```go +func (ke *LkkEncrypt) RsaPrivateEncrypt(clearText, privateKey []byte) ([]byte, error) +``` +RsaPrivateEncrypt RSA私钥加密.比解密耗时. clearText为明文,privateKey为私钥. + +#### func (*LkkEncrypt) RsaPrivateEncryptLong + +```go +func (ke *LkkEncrypt) RsaPrivateEncryptLong(clearText, privateKey []byte) ([]byte, error) +``` +RsaPrivateEncryptLong RSA私钥加密长文本.比解密耗时. clearText为明文,privateKey为私钥. + +#### func (*LkkEncrypt) RsaPublicDecrypt + +```go +func (ke *LkkEncrypt) RsaPublicDecrypt(cipherText, publicKey []byte) ([]byte, error) +``` +RsaPublicDecrypt RSA公钥解密. cipherText为密文,publicKey为公钥. + +#### func (*LkkEncrypt) RsaPublicDecryptLong + +```go +func (ke *LkkEncrypt) RsaPublicDecryptLong(cipherText, publicKey []byte) ([]byte, error) +``` +RsaPublicDecryptLong RSA公钥解密长文本. cipherText为密文,publicKey为公钥. + +#### func (*LkkEncrypt) RsaPublicEncrypt + +```go +func (ke *LkkEncrypt) RsaPublicEncrypt(clearText, publicKey []byte) ([]byte, error) +``` +RsaPublicEncrypt RSA公钥加密. clearText为明文,publicKey为公钥. + +#### func (*LkkEncrypt) RsaPublicEncryptLong + +```go +func (ke *LkkEncrypt) RsaPublicEncryptLong(clearText, publicKey []byte) ([]byte, error) +``` +RsaPublicEncryptLong RSA公钥加密长文本. + +#### type LkkFile + +```go +type LkkFile struct { +} +``` + +LkkFile is the receiver of file utilities + +#### func (*LkkFile) AbsPath + +```go +func (kf *LkkFile) AbsPath(fpath string) string +``` +AbsPath 获取绝对路径,path可允许不存在. + +#### func (*LkkFile) AppendFile + +```go +func (kf *LkkFile) AppendFile(fpath string, data []byte) error +``` +AppendFile 插入文件内容.若文件不存在,则自动创建. + +#### func (*LkkFile) Basename + +```go +func (kf *LkkFile) Basename(fpath string) string +``` +Basename 返回路径中的文件名部分(包括后缀),空路径时返回".". + +#### func (*LkkFile) ChmodBatch + +```go +func (kf *LkkFile) ChmodBatch(fpath string, filemode, dirmode os.FileMode) (res bool) +``` +ChmodBatch 批量改变路径权限模式(包括子目录和所属文件). filemode为文件权限模式,dirmode为目录权限模式. + +#### func (*LkkFile) CopyDir + +```go +func (kf *LkkFile) CopyDir(source string, dest string, cover LkkFileCover) (int64, error) +``` +CopyDir +拷贝目录.source为源目录,dest为目标目录,cover为是否覆盖,枚举值(FILE_COVER_ALLOW、FILE_COVER_IGNORE、FILE_COVER_DENY). + +#### func (*LkkFile) CopyFile + +```go +func (kf *LkkFile) CopyFile(source string, dest string, cover LkkFileCover) (int64, error) +``` +CopyFile +拷贝source源文件到dest目标文件,cover为是否覆盖,枚举值(FILE_COVER_ALLOW、FILE_COVER_IGNORE、FILE_COVER_DENY). + +#### func (*LkkFile) CopyLink + +```go +func (kf *LkkFile) CopyLink(source string, dest string, cover LkkFileCover) error +``` +CopyLink +拷贝链接.source为源链接,dest为目标链接,cover为是否覆盖,枚举值(FILE_COVER_ALLOW、FILE_COVER_IGNORE、FILE_COVER_DENY). + +#### func (*LkkFile) CountLines + +```go +func (kf *LkkFile) CountLines(fpath string, buffLength int) (int, error) +``` +CountLines 统计文件行数.buffLength为缓冲长度,kb. + +#### func (*LkkFile) DelDir + +```go +func (kf *LkkFile) DelDir(dir string, delete bool) error +``` +DelDir 删除目录.delete为true时连该目录一起删除;为false时只清空该目录. + +#### func (*LkkFile) DirSize + +```go +func (kf *LkkFile) DirSize(fpath string) int64 +``` +DirSize 获取目录大小(bytes字节). + +#### func (*LkkFile) Dirname + +```go +func (kf *LkkFile) Dirname(fpath string) string +``` +Dirname 返回路径中的目录部分,注意空路径或无目录的返回".". + +#### func (*LkkFile) FastCopy + +```go +func (kf *LkkFile) FastCopy(source string, dest string) (int64, error) +``` +FastCopy 快速拷贝源文件到目标文件,不做安全检查. + +#### func (*LkkFile) FileSize + +```go +func (kf *LkkFile) FileSize(fpath string) int64 +``` +FileSize 获取文件大小(bytes字节);注意:文件不存在或无法访问时返回-1 . + +#### func (*LkkFile) FileTree + +```go +func (kf *LkkFile) FileTree(fpath string, ftype LkkFileTree, recursive bool, filters ...FileFilter) []string +``` +FileTree 获取目录的文件树列表. ftype为枚举(FILE_TREE_ALL、FILE_TREE_DIR、FILE_TREE_FILE); +recursive为是否递归; filters为一个或多个文件过滤器函数,FileFilter类型. + +#### func (*LkkFile) FormatDir + +```go +func (kf *LkkFile) FormatDir(fpath string) string +``` +FormatDir 格式化目录,将"\","//"替换为"/",且以"/"结尾. + +#### func (*LkkFile) FormatPath + +```go +func (kf *LkkFile) FormatPath(fpath string) string +``` +FormatPath 格式化路径. + +#### func (*LkkFile) GetExt + +```go +func (kf *LkkFile) GetExt(fpath string) string +``` +GetExt 获取文件的小写扩展名,不包括点"." . + +#### func (*LkkFile) GetFileMode + +```go +func (kf *LkkFile) GetFileMode(fpath string) (os.FileMode, error) +``` +GetFileMode 获取路径的权限模式. + +#### func (*LkkFile) GetMime + +```go +func (kf *LkkFile) GetMime(fpath string, fast bool) string +``` +GetMime 获取文件mime类型;fast为true时根据后缀快速获取;为false时读取文件头获取. + +#### func (*LkkFile) GetModTime + +```go +func (kf *LkkFile) GetModTime(fpath string) (res int64) +``` +GetModTime 获取文件的修改时间戳,秒. + +#### func (*LkkFile) Glob + +```go +func (kf *LkkFile) Glob(pattern string) ([]string, error) +``` +Glob 寻找与模式匹配的文件路径. + +#### func (*LkkFile) Img2Base64 + +```go +func (kf *LkkFile) Img2Base64(fpath string) (string, error) +``` +Img2Base64 读取图片文件,并转换为base64字符串. + +#### func (*LkkFile) IsBinary + +```go +func (kf *LkkFile) IsBinary(fpath string) bool +``` +IsBinary 是否二进制文件(且存在). + +#### func (*LkkFile) IsDir + +```go +func (kf *LkkFile) IsDir(fpath string) bool +``` +IsDir 是否目录(且存在). + +#### func (*LkkFile) IsExecutable + +```go +func (kf *LkkFile) IsExecutable(fpath string) bool +``` +IsExecutable 是否可执行文件. + +#### func (*LkkFile) IsExist + +```go +func (kf *LkkFile) IsExist(fpath string) bool +``` +IsExist 路径(文件/目录)是否存在. + +#### func (*LkkFile) IsFile + +```go +func (kf *LkkFile) IsFile(fpath string, ftype ...LkkFileType) (res bool) +``` +IsFile 是否(某类型)文件,且存在. +ftype为枚举(FILE_TYPE_ANY、FILE_TYPE_LINK、FILE_TYPE_REGULAR、FILE_TYPE_COMMON),默认FILE_TYPE_ANY; + +#### func (*LkkFile) IsImg + +```go +func (kf *LkkFile) IsImg(fpath string) bool +``` +IsImg 是否图片文件(仅检查后缀). + +#### func (*LkkFile) IsLink + +```go +func (kf *LkkFile) IsLink(fpath string) bool +``` +IsLink 是否链接文件(软链接,且存在). + +#### func (*LkkFile) IsReadable + +```go +func (kf *LkkFile) IsReadable(fpath string) bool +``` +IsReadable 路径是否可读. + +#### func (*LkkFile) IsWritable + +```go +func (kf *LkkFile) IsWritable(fpath string) bool +``` +IsWritable 路径是否可写. + +#### func (*LkkFile) IsZip + +```go +func (kf *LkkFile) IsZip(fpath string) (bool, error) +``` +IsZip 是否zip文件. + +#### func (*LkkFile) Md5File + +```go +func (kf *LkkFile) Md5File(fpath string, length uint8) (string, error) +``` +Md5File 获取文件md5值,fpath为文件路径,length指定结果长度32/16. + +#### func (*LkkFile) Md5Reader + +```go +func (kf *LkkFile) Md5Reader(reader io.Reader, length uint8) (string, error) +``` +Md5Reader 计算Reader的 MD5 散列值. + +#### func (*LkkFile) Mkdir + +```go +func (kf *LkkFile) Mkdir(fpath string, mode os.FileMode) error +``` +Mkdir 创建目录,允许多级. + +#### func (*LkkFile) Pathinfo + +```go +func (kf *LkkFile) Pathinfo(fpath string, option int) map[string]string +``` +Pathinfo 获取文件路径的信息. option为要返回的信息,枚举值如下: -1: all; 1: dirname; 2: basename; 4: +extension; 8: filename; 若要查看某几项,则为它们之间的和. + +#### func (*LkkFile) ReadFile + +```go +func (kf *LkkFile) ReadFile(fpath string) ([]byte, error) +``` +ReadFile 读取文件内容. + +#### func (*LkkFile) ReadFirstLine + +```go +func (kf *LkkFile) ReadFirstLine(fpath string) []byte +``` +ReadFirstLine 读取文件首行. + +#### func (*LkkFile) ReadInArray + +```go +func (kf *LkkFile) ReadInArray(fpath string) ([]string, error) +``` +ReadInArray 把整个文件读入一个数组中,每行作为一个元素. + +#### func (*LkkFile) ReadLastLine + +```go +func (kf *LkkFile) ReadLastLine(fpath string) []byte +``` +ReadLastLine 读取文件末行. + +#### func (*LkkFile) RealPath + +```go +func (kf *LkkFile) RealPath(fpath string) string +``` +RealPath 返回规范化的真实绝对路径名.path必须存在,若路径不存在则返回空字符串. + +#### func (*LkkFile) Rename + +```go +func (kf *LkkFile) Rename(oldname, newname string) error +``` +Rename 重命名(或移动)文件/目录. + +#### func (*LkkFile) SafeFileName + +```go +func (kf *LkkFile) SafeFileName(str string) string +``` +SafeFileName 将文件名转换为安全可用的字符串. + +#### func (*LkkFile) ShaXFile + +```go +func (kf *LkkFile) ShaXFile(fpath string, x uint16) (string, error) +``` +ShaXFile 计算文件的 shaX 散列值,fpath为文件路径,x为1/256/512. + +#### func (*LkkFile) ShaXReader + +```go +func (kf *LkkFile) ShaXReader(reader io.Reader, x uint16) (string, error) +``` +ShaXReader 计算Reader的 shaX 散列值,x为1/256/512. + +#### func (*LkkFile) TarGz + +```go +func (kf *LkkFile) TarGz(src string, dstTar string, ignorePatterns ...string) (bool, error) +``` +TarGz 打包压缩tar.gz. src为源文件或目录,dstTar为打包的路径名,ignorePatterns为要忽略的文件正则. + +#### func (*LkkFile) Touch + +```go +func (kf *LkkFile) Touch(fpath string, size int64) (res bool) +``` +Touch 快速创建指定大小的文件,fpath为文件路径,size为字节. + +#### func (*LkkFile) UnTarGz + +```go +func (kf *LkkFile) UnTarGz(srcTar, dstDir string) (bool, error) +``` +UnTarGz 将tar.gz文件解压缩. srcTar为压缩包,dstDir为解压目录. + +#### func (*LkkFile) UnZip + +```go +func (kf *LkkFile) UnZip(srcZip, dstDir string) (bool, error) +``` +UnZip 解压zip文件.srcZip为zip文件路径,dstDir为解压目录. + +#### func (*LkkFile) Unlink + +```go +func (kf *LkkFile) Unlink(fpath string) error +``` +Unlink 删除文件. + +#### func (*LkkFile) WriteFile + +```go +func (kf *LkkFile) WriteFile(fpath string, data []byte, perm ...os.FileMode) error +``` +WriteFile 将内容写入文件. fpath为文件路径;data为内容;perm为权限,默认为0655. + +#### func (*LkkFile) Zip + +```go +func (kf *LkkFile) Zip(dst string, fpaths ...string) (bool, error) +``` +Zip 将文件或目录进行zip打包.fpaths为源文件或目录的路径. + +#### type LkkFileCover + +```go +type LkkFileCover int8 +``` + +LkkFileCover 枚举类型,文件是否覆盖 + +#### type LkkFileTree + +```go +type LkkFileTree uint8 +``` + +LkkFileTree 枚举类型,文件树查找类型 + +#### type LkkFileType + +```go +type LkkFileType uint8 +``` + +LkkFileType 枚举类型,文件类型 + +#### type LkkNumber + +```go +type LkkNumber struct { +} +``` + +LkkNumber is the receiver of number utilities + +#### func (*LkkNumber) AbsFloat + +```go +func (kn *LkkNumber) AbsFloat(number float64) float64 +``` +AbsFloat 浮点型取绝对值. + +#### func (*LkkNumber) AbsInt + +```go +func (kn *LkkNumber) AbsInt(number int64) int64 +``` +AbsInt 整型取绝对值. + +#### func (*LkkNumber) Average + +```go +func (kn *LkkNumber) Average(nums ...interface{}) (res float64) +``` +Average 对任意类型序列中的数值类型求平均值,忽略非数值的. + +#### func (*LkkNumber) AverageFloat32 + +```go +func (kn *LkkNumber) AverageFloat32(nums ...float32) (res float32) +``` +AverageFloat32 对32位浮点数序列求平均值. + +#### func (*LkkNumber) AverageFloat64 + +```go +func (kn *LkkNumber) AverageFloat64(nums ...float64) (res float64) +``` +AverageFloat64 对64位浮点数序列求平均值. + +#### func (*LkkNumber) AverageInt + +```go +func (kn *LkkNumber) AverageInt(nums ...int) (res float64) +``` +AverageInt 对int整数序列求平均值. + +#### func (*LkkNumber) AverageInt64 + +```go +func (kn *LkkNumber) AverageInt64(nums ...int64) (res float64) +``` +AverageInt64 对int64整数序列求平均值. + +#### func (*LkkNumber) ByteFormat + +```go +func (kn *LkkNumber) ByteFormat(size float64, decimal uint8, delimiter string) string +``` +ByteFormat 格式化文件比特大小. size为文件大小,decimal为要保留的小数位数,delimiter为数字和单位间的分隔符. + +#### func (*LkkNumber) Ceil + +```go +func (kn *LkkNumber) Ceil(value float64) float64 +``` +Ceil 向上取整. + +#### func (*LkkNumber) Exp + +```go +func (kn *LkkNumber) Exp(x float64) float64 +``` +Exp 计算 e 的指数. + +#### func (*LkkNumber) Expm1 + +```go +func (kn *LkkNumber) Expm1(x float64) float64 +``` +Expm1 返回 exp(x) - 1. + +#### func (*LkkNumber) FloatEqual + +```go +func (kn *LkkNumber) FloatEqual(f1 float64, f2 float64, decimal ...uint8) (res bool) +``` +FloatEqual 比较两个浮点数是否相等.decimal为小数精确位数,默认为 FLOAT_DECIMAL . +有效数值是长度(包括小数点)为17位之内的数值,最后一位会四舍五入. + +#### func (*LkkNumber) Floor + +```go +func (kn *LkkNumber) Floor(value float64) float64 +``` +Floor 向下取整. + +#### func (*LkkNumber) GeoDistance + +```go +func (kn *LkkNumber) GeoDistance(lng1, lat1, lng2, lat2 float64) float64 +``` +GeoDistance 获取地理距离/米. 参数分别为两点的经度和纬度:lat:-90~90,lng:-180~180. + +#### func (*LkkNumber) InRange + +```go +func (kn *LkkNumber) InRange(value interface{}, left interface{}, right interface{}) bool +``` +InRange 数值是否在某个范围内,将自动转换类型再比较. + +#### func (*LkkNumber) InRangeFloat32 + +```go +func (kn *LkkNumber) InRangeFloat32(value, left, right float32) bool +``` +InRangeFloat32 数值是否在2个32位浮点数范围内. + +#### func (*LkkNumber) InRangeFloat64 + +```go +func (kn *LkkNumber) InRangeFloat64(value, left, right float64) bool +``` +InRangeFloat64 数值是否在2个64位浮点数范围内. + +#### func (*LkkNumber) InRangeInt + +```go +func (kn *LkkNumber) InRangeInt(value, left, right int) bool +``` +InRangeInt 数值是否在2个整数范围内. + +#### func (*LkkNumber) IsEven + +```go +func (kn *LkkNumber) IsEven(val int) bool +``` +IsEven 变量是否偶数. + +#### func (*LkkNumber) IsNan + +```go +func (kn *LkkNumber) IsNan(val interface{}) bool +``` +IsNan 是否为“非数值”.注意,这里复数也算“非数值”. + +#### func (*LkkNumber) IsNatural + +```go +func (kn *LkkNumber) IsNatural(value float64) bool +``` +IsNatural 数值是否为自然数(包括0). + +#### func (*LkkNumber) IsNaturalRange + +```go +func (kn *LkkNumber) IsNaturalRange(arr []int, strict bool) (res bool) +``` +IsNaturalRange 是否连续的自然数数组/切片,如[0,1,2,3...],其中不能有间断. strict为是否严格检查元素的顺序. + +#### func (*LkkNumber) IsNegative + +```go +func (kn *LkkNumber) IsNegative(value float64) bool +``` +IsNegative 数值是否为负数. + +#### func (*LkkNumber) IsNonNegative + +```go +func (kn *LkkNumber) IsNonNegative(value float64) bool +``` +IsNonNegative 数值是否为非负数. + +#### func (*LkkNumber) IsNonPositive + +```go +func (kn *LkkNumber) IsNonPositive(value float64) bool +``` +IsNonPositive 数值是否为非正数. + +#### func (*LkkNumber) IsOdd + +```go +func (kn *LkkNumber) IsOdd(val int) bool +``` +IsOdd 变量是否奇数. + +#### func (*LkkNumber) IsPositive + +```go +func (kn *LkkNumber) IsPositive(value float64) bool +``` +IsPositive 数值是否为正数. + +#### func (*LkkNumber) IsWhole + +```go +func (kn *LkkNumber) IsWhole(value float64) bool +``` +IsWhole 数值是否为整数. + +#### func (*LkkNumber) Log + +```go +func (kn *LkkNumber) Log(x, y float64) float64 +``` +Log 对数表达式,求以y为底x的对数. + +#### func (*LkkNumber) Max + +```go +func (kn *LkkNumber) Max(nums ...interface{}) (res float64) +``` +Max 取出任意类型中数值类型的最大值,无数值类型则为0. + +#### func (*LkkNumber) MaxFloat32 + +```go +func (kn *LkkNumber) MaxFloat32(nums ...float32) (res float32) +``` +MaxFloat32 32位浮点数序列求最大值. + +#### func (*LkkNumber) MaxFloat64 + +```go +func (kn *LkkNumber) MaxFloat64(nums ...float64) (res float64) +``` +MaxFloat64 64位浮点数序列求最大值. + +#### func (*LkkNumber) MaxInt + +```go +func (kn *LkkNumber) MaxInt(nums ...int) (res int) +``` +MaxInt int整数序列求最大值. + +#### func (*LkkNumber) MaxInt64 + +```go +func (kn *LkkNumber) MaxInt64(nums ...int64) (res int64) +``` +MaxInt64 int64整数序列求最大值. + +#### func (*LkkNumber) Min + +```go +func (kn *LkkNumber) Min(nums ...interface{}) (res float64) +``` +Min 取出任意类型中数值类型的最小值,无数值类型则为0. + +#### func (*LkkNumber) MinFloat32 + +```go +func (kn *LkkNumber) MinFloat32(nums ...float32) (res float32) +``` +MinFloat32 32位浮点数序列求最小值. + +#### func (*LkkNumber) MinFloat64 + +```go +func (kn *LkkNumber) MinFloat64(nums ...float64) (res float64) +``` +MinFloat64 64位浮点数序列求最小值. + +#### func (*LkkNumber) MinInt + +```go +func (kn *LkkNumber) MinInt(nums ...int) (res int) +``` +MinInt int整数序列求最小值. + +#### func (*LkkNumber) MinInt64 + +```go +func (kn *LkkNumber) MinInt64(nums ...int64) (res int64) +``` +MinInt64 int64整数序列求最小值. + +#### func (*LkkNumber) NearLogarithm + +```go +func (kn *LkkNumber) NearLogarithm(num, base int, left bool) int +``` +NearLogarithm 求以 base 为底 num 的对数临近值. num为自然数,base为正整数,left是否向左取整. + +#### func (*LkkNumber) NumSign + +```go +func (kn *LkkNumber) NumSign(value float64) (res int8) +``` +NumSign 返回数值的符号.值>0为1,<0为-1,其他为0. + +#### func (*LkkNumber) NumberFormat + +```go +func (kn *LkkNumber) NumberFormat(number float64, decimal uint8, point, thousand string) string +``` +NumberFormat 以千位分隔符方式格式化一个数字. +decimal为要保留的小数位数,point为小数点显示的字符,thousand为千位分隔符显示的字符. +有效数值是长度(包括小数点)为17位之内的数值,最后一位会四舍五入. + +#### func (*LkkNumber) Percent + +```go +func (kn *LkkNumber) Percent(val, total interface{}) float64 +``` +Percent 返回百分比((val/total) *100). + +#### func (*LkkNumber) Pow + +```go +func (kn *LkkNumber) Pow(x, y float64) float64 +``` +Pow 指数表达式,求x的y次方. + +#### func (*LkkNumber) Rand + +```go +func (kn *LkkNumber) Rand(min, max int) int +``` +Rand RandInt的别名. + +#### func (*LkkNumber) RandFloat64 + +```go +func (kn *LkkNumber) RandFloat64(min, max float64) float64 +``` +RandFloat64 生成一个min~max范围内的随机float64浮点数. + +#### func (*LkkNumber) RandInt + +```go +func (kn *LkkNumber) RandInt(min, max int) int +``` +RandInt 生成一个min~max范围内的随机int整数. + +#### func (*LkkNumber) RandInt64 + +```go +func (kn *LkkNumber) RandInt64(min, max int64) int64 +``` +RandInt64 生成一个min~max范围内的随机int64整数. + +#### func (*LkkNumber) Range + +```go +func (kn *LkkNumber) Range(start, end int) []int +``` +Range 根据范围创建数组,包含指定的元素. +start为起始元素值,end为末尾元素值.若startend,返回降序的数组. + +#### func (*LkkNumber) Round + +```go +func (kn *LkkNumber) Round(value float64) float64 +``` +Round 对浮点数(的整数)进行四舍五入. + +#### func (*LkkNumber) RoundPlus + +```go +func (kn *LkkNumber) RoundPlus(value float64, precision uint8) float64 +``` +RoundPlus 对指定的小数位进行四舍五入. precision为小数位数. + +#### func (*LkkNumber) SplitNaturalNum + +```go +func (kn *LkkNumber) SplitNaturalNum(num, base int) []int +``` +SplitNaturalNum 将自然数 num 按底数 base 进行拆解;所得结果的列表累计和为num. + +#### func (*LkkNumber) Sum + +```go +func (kn *LkkNumber) Sum(nums ...interface{}) (res float64) +``` +Sum 对任意类型序列中的数值类型求和,忽略非数值的. + +#### func (*LkkNumber) SumFloat32 + +```go +func (kn *LkkNumber) SumFloat32(nums ...float32) float32 +``` +SumFloat32 32位浮点数求和. + +#### func (*LkkNumber) SumFloat64 + +```go +func (kn *LkkNumber) SumFloat64(nums ...float64) float64 +``` +SumFloat64 64位浮点数求和. + +#### func (*LkkNumber) SumInt + +```go +func (kn *LkkNumber) SumInt(nums ...int) int +``` +SumInt int整数求和. + +#### func (*LkkNumber) SumInt64 + +```go +func (kn *LkkNumber) SumInt64(nums ...int64) int64 +``` +SumInt64 int64整数求和. + +#### type LkkOS + +```go +type LkkOS struct { +} +``` + +LkkOS is the receiver of OS utilities + +#### func (*LkkOS) Chdir + +```go +func (ko *LkkOS) Chdir(dir string) error +``` +Chdir 改变/进入新的工作目录. + +#### func (*LkkOS) Chmod + +```go +func (ko *LkkOS) Chmod(filename string, mode os.FileMode) bool +``` +Chmod 改变文件模式. + +#### func (*LkkOS) Chown + +```go +func (ko *LkkOS) Chown(filename string, uid, gid int) bool +``` +Chown 改变文件的所有者. + +#### func (*LkkOS) ClientIp + +```go +func (ko *LkkOS) ClientIp(req *http.Request) string +``` +ClientIp 获取客户端真实IP,req为http请求. + +#### func (*LkkOS) CpuUsage + +```go +func (ko *LkkOS) CpuUsage() (user, idle, total uint64) +``` +CpuUsage 获取CPU使用率(darwin系统必须使用cgo),单位jiffies(节拍数). user为用户态(用户进程)的运行时间, +idle为空闲时间, total为累计时间. + +#### func (*LkkOS) DiskUsage + +```go +func (ko *LkkOS) DiskUsage(path string) (used, free, total uint64) +``` +DiskUsage 获取磁盘(目录)使用情况,单位字节.参数path为路径. used为已用, free为空闲, total为总数. + +#### func (*LkkOS) DownloadFile + +```go +func (ko *LkkOS) DownloadFile(url string, savePath string, cover bool, client *http.Client) (written int64, err error) +``` +DownloadFile 下载文件.其中 url 为文件网址; savePath 为保存路径; cover 是否覆盖已有文件; client +为自定义的请求客户端,不提供时默认使用http.DefaultClient. + +#### func (*LkkOS) Exec + +```go +func (ko *LkkOS) Exec(command string) (retInt int, outStr, errStr []byte) +``` +Exec 执行一个外部命令. retInt为1时失败,为0时成功;outStr为执行命令的输出;errStr为错误输出. 命令如 "ls -a" +"/bin/bash -c \"ls -a\"" + +#### func (*LkkOS) ForceGC + +```go +func (ko *LkkOS) ForceGC() +``` +ForceGC 强制手动GC垃圾回收(阻塞). + +#### func (*LkkOS) GetBiosInfo + +```go +func (ko *LkkOS) GetBiosInfo() *BiosInfo +``` +GetBiosInfo 获取BIOS信息. 注意:Mac机器没有BIOS信息,它使用EFI. + +#### func (*LkkOS) GetBoardInfo + +```go +func (ko *LkkOS) GetBoardInfo() *BoardInfo +``` +GetBoardInfo 获取Board信息. + +#### func (*LkkOS) GetCpuInfo + +```go +func (ko *LkkOS) GetCpuInfo() *CpuInfo +``` +GetCpuInfo 获取CPU信息. + +#### func (*LkkOS) GetEndian + +```go +func (ko *LkkOS) GetEndian() binary.ByteOrder +``` +GetEndian 获取系统字节序类型,小端返回binary.LittleEndian,大端返回binary.BigEndian . + +#### func (*LkkOS) GetHostByIp + +```go +func (ko *LkkOS) GetHostByIp(ipAddress string) (string, error) +``` +GetHostByIp 获取指定的IP地址对应的主机名. + +#### func (*LkkOS) GetIPs + +```go +func (ko *LkkOS) GetIPs() (ips []string) +``` +GetIPs 获取本机的IP列表. + +#### func (*LkkOS) GetIpByHostname + +```go +func (ko *LkkOS) GetIpByHostname(hostname string) (string, error) +``` +GetIpByHostname 返回主机名对应的 IPv4地址. + +#### func (*LkkOS) GetIpsByDomain + +```go +func (ko *LkkOS) GetIpsByDomain(domain string) ([]string, error) +``` +GetIpsByDomain 获取互联网域名/主机名对应的 IPv4 地址列表. + +#### func (*LkkOS) GetMacAddrs + +```go +func (ko *LkkOS) GetMacAddrs() (macAddrs []string) +``` +GetMacAddrs 获取本机的Mac网卡地址列表. + +#### func (*LkkOS) GetPidByPort + +```go +func (ko *LkkOS) GetPidByPort(port int) (pid int) +``` +GetPidByPort 根据端口号获取监听的进程PID. linux可能要求root权限; darwin依赖lsof; windows依赖netstat. + +#### func (*LkkOS) GetProcessExecPath + +```go +func (ko *LkkOS) GetProcessExecPath(pid int) string +``` +GetProcessExecPath 根据PID获取进程的执行路径. + +#### func (*LkkOS) GetSystemInfo + +```go +func (ko *LkkOS) GetSystemInfo() *SystemInfo +``` +GetSystemInfo 获取系统运行信息. + +#### func (*LkkOS) GetTempDir + +```go +func (ko *LkkOS) GetTempDir() string +``` +GetTempDir 返回用于临时文件的目录. + +#### func (*LkkOS) Getcwd + +```go +func (ko *LkkOS) Getcwd() (string, error) +``` +Getcwd 取得当前工作目录(程序可能在任务中进行多次目录切换). + +#### func (*LkkOS) Getenv + +```go +func (ko *LkkOS) Getenv(varname string, defvalue ...string) string +``` +Getenv 获取一个环境变量的值.defvalue为默认值. + +#### func (*LkkOS) GoMemory + +```go +func (ko *LkkOS) GoMemory() uint64 +``` +GoMemory 获取当前go程序的内存使用,返回字节数. + +#### func (*LkkOS) HomeDir + +```go +func (ko *LkkOS) HomeDir() (string, error) +``` +HomeDir 获取当前用户的主目录. + +#### func (*LkkOS) Hostname + +```go +func (ko *LkkOS) Hostname() (string, error) +``` +Hostname 获取主机名. + +#### func (*LkkOS) IsLinux + +```go +func (ko *LkkOS) IsLinux() bool +``` +IsLinux 当前操作系统是否Linux. + +#### func (*LkkOS) IsLittleEndian + +```go +func (ko *LkkOS) IsLittleEndian() bool +``` +IsLittleEndian 系统字节序类型是否小端存储. + +#### func (*LkkOS) IsMac + +```go +func (ko *LkkOS) IsMac() bool +``` +IsMac 当前操作系统是否Mac OS/X. + +#### func (*LkkOS) IsPortOpen + +```go +func (ko *LkkOS) IsPortOpen(host string, port interface{}, protocols ...string) bool +``` +IsPortOpen 检查主机端口是否开放. host为主机名;port为(整型/字符串)端口号;protocols为协议名称,可选,默认tcp. + +#### func (*LkkOS) IsPrivateIp + +```go +func (ko *LkkOS) IsPrivateIp(str string) (bool, error) +``` +IsPrivateIp 是否私有IP地址(ipv4/ipv6). + +#### func (*LkkOS) IsProcessExists + +```go +func (ko *LkkOS) IsProcessExists(pid int) (res bool) +``` +IsProcessExists 进程是否存在. + +#### func (*LkkOS) IsPublicIP + +```go +func (ko *LkkOS) IsPublicIP(str string) (bool, error) +``` +IsPublicIP 是否公网IPv4. + +#### func (*LkkOS) IsWindows + +```go +func (ko *LkkOS) IsWindows() bool +``` +IsWindows 当前操作系统是否Windows. + +#### func (*LkkOS) LocalIP + +```go +func (ko *LkkOS) LocalIP() (string, error) +``` +LocalIP 获取本机第一个NIC's IP. + +#### func (*LkkOS) MemoryUsage + +```go +func (ko *LkkOS) MemoryUsage(virtual bool) (used, free, total uint64) +``` +MemoryUsage 获取内存使用率,单位字节. 参数 virtual(仅支持linux),是否取虚拟内存. used为已用, free为空闲, +total为总数. + +#### func (*LkkOS) OutboundIP + +```go +func (ko *LkkOS) OutboundIP() (string, error) +``` +OutboundIP 获取本机的出口IP. + +#### func (*LkkOS) PrivateCIDR + +```go +func (ko *LkkOS) PrivateCIDR() []*net.IPNet +``` +PrivateCIDR 获取私有网段的CIDR(无类别域间路由). + +#### func (*LkkOS) Pwd + +```go +func (ko *LkkOS) Pwd() string +``` +Pwd 获取当前程序运行所在的路径,注意和Getwd有所不同. 若当前执行的是链接文件,则会指向真实二进制程序的所在目录. + +#### func (*LkkOS) Setenv + +```go +func (ko *LkkOS) Setenv(varname, data string) error +``` +Setenv 设置一个环境变量的值. + +#### func (*LkkOS) System + +```go +func (ko *LkkOS) System(command string) (retInt int, outStr, errStr []byte) +``` +System 与Exec相同,但会同时打印标准输出和标准错误. + +#### func (*LkkOS) TriggerGC + +```go +func (ko *LkkOS) TriggerGC() +``` +TriggerGC 触发GC(非阻塞). + +#### func (*LkkOS) Unsetenv + +```go +func (ko *LkkOS) Unsetenv(varname string) error +``` +Unsetenv 删除一个环境变量. + +#### func (*LkkOS) Uptime + +```go +func (ko *LkkOS) Uptime() (uint64, error) +``` +Uptime 获取系统运行时间,秒. + +#### type LkkPKCSType + +```go +type LkkPKCSType int8 +``` + +LkkPKCSType 枚举类型,PKCS填充类型 + +#### type LkkPadType + +```go +type LkkPadType uint8 +``` + +LkkPadType 枚举类型,字符串填充类型 + +#### type LkkRandString + +```go +type LkkRandString uint8 +``` + +LkkRandString 枚举类型,随机字符串类型 + +#### type LkkString + +```go +type LkkString struct { +} +``` + +LkkString is the receiver of string utilities + +#### func (*LkkString) Addslashes + +```go +func (ks *LkkString) Addslashes(str string) string +``` +Addslashes 使用反斜线引用字符串. + +#### func (*LkkString) AtWho + +```go +func (ks *LkkString) AtWho(text string, minLen ...int) []string +``` +AtWho 查找被@的用户名.minLen为用户名最小长度,默认5. + +#### func (*LkkString) Big5ToUtf8 + +```go +func (ks *LkkString) Big5ToUtf8(s []byte) ([]byte, error) +``` +Big5ToUtf8 BIG5转UTF-8编码. + +#### func (*LkkString) Br2nl + +```go +func (ks *LkkString) Br2nl(str string) string +``` +Br2nl 将br标签转换为换行符. + +#### func (*LkkString) Chr + +```go +func (ks *LkkString) Chr(chr uint) string +``` +Chr 返回相对应于 ASCII 所指定的单个字符. + +#### func (*LkkString) ChunkBytes + +```go +func (ks *LkkString) ChunkBytes(bs []byte, size int) [][]byte +``` +ChunkBytes 将字节切片分割为多个小块.其中size为每块的长度. + +#### func (*LkkString) ChunkSplit + +```go +func (ks *LkkString) ChunkSplit(str string, chunklen uint, end string) string +``` +ChunkSplit 将字符串分割成小块.str为要分割的字符,chunklen为分割的尺寸,end为行尾序列符号. + +#### func (*LkkString) ClearUrlPrefix + +```go +func (ks *LkkString) ClearUrlPrefix(str string, prefix ...string) string +``` +ClearUrlPrefix 清除URL的前缀; str为URL字符串,prefix为前缀,默认"/". + +#### func (*LkkString) ClearUrlSuffix + +```go +func (ks *LkkString) ClearUrlSuffix(str string, suffix ...string) string +``` +ClearUrlSuffix 清除URL的后缀; str为URL字符串,suffix为后缀,默认"/". + +#### func (*LkkString) ClosestWord + +```go +func (ks *LkkString) ClosestWord(word string, searchs []string) (string, int) +``` +ClosestWord 获取与原字符串相似度最高的字符串,以及它们的编辑距离. word为原字符串,searchs为待查找的字符串数组. + +#### func (*LkkString) CountBase64Byte + +```go +func (ks *LkkString) CountBase64Byte(str string) (res int) +``` +CountBase64Byte 粗略统计base64字符串大小,字节. + +#### func (*LkkString) CountWords + +```go +func (ks *LkkString) CountWords(str string) (int, map[string]int) +``` +CountWords 统计字符串中单词的使用情况. 返回结果:单词总数;和一个字典,包含每个单词的单独统计. 因为没有分词,对中文尚未很好支持. + +#### func (*LkkString) Crc32 + +```go +func (ks *LkkString) Crc32(str string) uint32 +``` +Crc32 计算一个字符串的 crc32 多项式. + +#### func (*LkkString) DBC2SBC + +```go +func (ks *LkkString) DBC2SBC(s string) string +``` +DBC2SBC 半角转全角. + +#### func (*LkkString) DetectEncoding + +```go +func (ks *LkkString) DetectEncoding(str string) (res string) +``` +DetectEncoding 匹配字符编码,TODO. + +#### func (*LkkString) Dstrpos + +```go +func (ks *LkkString) Dstrpos(str string, arr []string, chkCase bool) (bool, string) +``` +Dstrpos 检查字符串str是否包含数组arr的元素之一,返回检查结果和匹配的字符串. chkCase为是否检查大小写. + +#### func (*LkkString) EndsWith + +```go +func (ks *LkkString) EndsWith(str, sub string, ignoreCase bool) bool +``` +EndsWith 字符串str是否以sub结尾. + +#### func (*LkkString) EndsWiths + +```go +func (ks *LkkString) EndsWiths(str string, subs []string, ignoreCase bool) (res bool) +``` +EndsWiths 字符串str是否以subs其中之一为结尾. + +#### func (*LkkString) Explode + +```go +func (ks *LkkString) Explode(str string, delimiters ...string) (res []string) +``` +Explode 字符串分割.delimiters为分隔符,可选,支持多个. + +#### func (*LkkString) FirstLetter + +```go +func (ks *LkkString) FirstLetter(str string) string +``` +FirstLetter 获取字符串首字母. + +#### func (*LkkString) FormatUrl + +```go +func (ks *LkkString) FormatUrl(str string) string +``` +FormatUrl 格式化URL. + +#### func (*LkkString) GbkToUtf8 + +```go +func (ks *LkkString) GbkToUtf8(s []byte) ([]byte, error) +``` +GbkToUtf8 GBK转UTF-8编码. + +#### func (*LkkString) GetDomain + +```go +func (ks *LkkString) GetDomain(str string, isMain ...bool) string +``` +GetDomain 从URL字符串中获取域名. +可选参数isMain,默认为false,取完整域名;为true时,取主域名(如abc.test.com取test.com). + +#### func (*LkkString) GetEquationValue + +```go +func (ks *LkkString) GetEquationValue(str, name string) (res string) +``` +GetEquationValue 获取等式str中变量name的值. + +#### func (*LkkString) Gravatar + +```go +func (ks *LkkString) Gravatar(email string, size uint16) string +``` +Gravatar 获取Gravatar头像地址. email为邮箱;size为头像尺寸像素. + +#### func (*LkkString) HasChinese + +```go +func (ks *LkkString) HasChinese(str string) bool +``` +HasChinese 字符串是否含有中文. + +#### func (*LkkString) HasEmoji + +```go +func (ks *LkkString) HasEmoji(str string) bool +``` +HasEmoji 字符串是否含有表情符. + +#### func (*LkkString) HasEnglish + +```go +func (ks *LkkString) HasEnglish(str string) bool +``` +HasEnglish 是否含有英文字符,HasLetter的别名. + +#### func (*LkkString) HasFullWidth + +```go +func (ks *LkkString) HasFullWidth(str string) bool +``` +HasFullWidth 是否含有全角字符. + +#### func (*LkkString) HasHalfWidth + +```go +func (ks *LkkString) HasHalfWidth(str string) bool +``` +HasHalfWidth 是否含有半角字符. + +#### func (*LkkString) HasLetter + +```go +func (ks *LkkString) HasLetter(str string) bool +``` +HasLetter 字符串是否含有(英文)字母. + +#### func (*LkkString) HasSpecialChar + +```go +func (ks *LkkString) HasSpecialChar(str string) bool +``` +HasSpecialChar 字符串是否含有特殊字符. + +#### func (*LkkString) HasWhitespace + +```go +func (ks *LkkString) HasWhitespace(str string) bool +``` +HasWhitespace 是否带有空白字符. + +#### func (*LkkString) HideCard + +```go +func (ks *LkkString) HideCard(card string) string +``` +HideCard 隐藏证件号码. + +#### func (*LkkString) HideMobile + +```go +func (ks *LkkString) HideMobile(mobile string) string +``` +HideMobile 隐藏手机号. + +#### func (*LkkString) HideTrueName + +```go +func (ks *LkkString) HideTrueName(name string) string +``` +HideTrueName 隐藏真实名称(如姓名、账号、公司等). + +#### func (*LkkString) Html2Text + +```go +func (ks *LkkString) Html2Text(str string) string +``` +Html2Text 将html转换为纯文本. + +#### func (*LkkString) Htmlentities + +```go +func (ks *LkkString) Htmlentities(str string) string +``` +Htmlentities 将字符转换为 HTML 转义字符. + +#### func (*LkkString) HtmlentityDecode + +```go +func (ks *LkkString) HtmlentityDecode(str string) string +``` +HtmlentityDecode 将HTML实体转换为它们对应的字符. + +#### func (*LkkString) HttpBuildQuery + +```go +func (ks *LkkString) HttpBuildQuery(queryData url.Values) string +``` +HttpBuildQuery 根据参数生成 URL-encode 之后的请求字符串. + +#### func (*LkkString) Img2Base64 + +```go +func (ks *LkkString) Img2Base64(content []byte, ext ...string) string +``` +Img2Base64 将图片字节转换为base64字符串.ext为图片扩展名,默认jpg. + +#### func (*LkkString) Index + +```go +func (ks *LkkString) Index(str, sub string, ignoreCase bool) int +``` +Index 查找子串sub在字符串str中第一次出现的位置,不存在则返回-1; ignoreCase为是否忽略大小写. + +#### func (*LkkString) IsASCII + +```go +func (ks *LkkString) IsASCII(str string) bool +``` +IsASCII 是否ASCII字符串. + +#### func (*LkkString) IsAlphaNumeric + +```go +func (ks *LkkString) IsAlphaNumeric(str string) bool +``` +IsAlphaNumeric 是否字母或数字. + +#### func (*LkkString) IsBase64 + +```go +func (ks *LkkString) IsBase64(str string) bool +``` +IsBase64 是否base64字符串. + +#### func (*LkkString) IsBase64Image + +```go +func (ks *LkkString) IsBase64Image(str string) (chk bool, ext string) +``` +IsBase64Image 是否base64编码的图片,并返回扩展名. + +#### func (*LkkString) IsBlank + +```go +func (ks *LkkString) IsBlank(str string) bool +``` +IsBlank 是否空(空白)字符串. + +#### func (*LkkString) IsChinese + +```go +func (ks *LkkString) IsChinese(str string) bool +``` +IsChinese 字符串是否全部中文. + +#### func (*LkkString) IsChineseName + +```go +func (ks *LkkString) IsChineseName(str string) bool +``` +IsChineseName 字符串是否中文名称. + +#### func (*LkkString) IsCreditNo + +```go +func (ks *LkkString) IsCreditNo(str string) (bool, string) +``` +IsCreditNo 检查是否(15或18位)身份证号码,并返回经校验的号码. + +#### func (*LkkString) IsDNSName + +```go +func (ks *LkkString) IsDNSName(str string) bool +``` +IsDNSName 是否DNS名称. + +#### func (*LkkString) IsDialAddr + +```go +func (ks *LkkString) IsDialAddr(str string) bool +``` +IsDialAddr 是否网络拨号地址(形如127.0.0.1:80),用于net.Dial()检查. + +#### func (*LkkString) IsEmail + +```go +func (ks *LkkString) IsEmail(email string, validateHost bool) (bool, error) +``` +IsEmail 检查字符串是否邮箱.参数validateTrue,是否验证邮箱主机的真实性. + +#### func (*LkkString) IsEmpty + +```go +func (ks *LkkString) IsEmpty(str string) bool +``` +IsEmpty 字符串是否为空(包括空格). + +#### func (*LkkString) IsEnglish + +```go +func (ks *LkkString) IsEnglish(str string, letterCase LkkCaseSwitch) bool +``` +IsEnglish 字符串是否纯英文.letterCase是否检查大小写,枚举值(CASE_NONE,CASE_LOWER,CASE_UPPER). + +#### func (*LkkString) IsGbk + +```go +func (ks *LkkString) IsGbk(s []byte) (res bool) +``` +IsGbk 字符串是否GBK编码. + +#### func (*LkkString) IsHexColor + +```go +func (ks *LkkString) IsHexColor(str string) (bool, string) +``` +IsHexColor 检查是否十六进制颜色,并返回带"#"的修正值. + +#### func (*LkkString) IsHost + +```go +func (ks *LkkString) IsHost(str string) bool +``` +IsHost 字符串是否主机名(IP或DNS名称). + +#### func (*LkkString) IsIP + +```go +func (ks *LkkString) IsIP(str string) bool +``` +IsIP 检查字符串是否IP地址. + +#### func (*LkkString) IsIPv4 + +```go +func (ks *LkkString) IsIPv4(str string) bool +``` +IsIPv4 检查字符串是否IPv4地址. + +#### func (*LkkString) IsIPv6 + +```go +func (ks *LkkString) IsIPv6(str string) bool +``` +IsIPv6 检查字符串是否IPv6地址. + +#### func (*LkkString) IsJSON + +```go +func (ks *LkkString) IsJSON(str string) bool +``` +IsJSON 字符串是否合法的json格式. + +#### func (*LkkString) IsLetters + +```go +func (ks *LkkString) IsLetters(str string) bool +``` +IsLetters 字符串是否全(英文)字母组成. + +#### func (*LkkString) IsLower + +```go +func (ks *LkkString) IsLower(str string) bool +``` +IsLower 字符串是否全部小写. + +#### func (*LkkString) IsMACAddr + +```go +func (ks *LkkString) IsMACAddr(str string) bool +``` +IsMACAddr 是否MAC物理网卡地址. + +#### func (*LkkString) IsMd5 + +```go +func (ks *LkkString) IsMd5(str string) bool +``` +IsMd5 是否md5值. + +#### func (*LkkString) IsMobilecn + +```go +func (ks *LkkString) IsMobilecn(str string) bool +``` +IsMobilecn 检查字符串是否中国大陆手机号. + +#### func (*LkkString) IsMultibyte + +```go +func (ks *LkkString) IsMultibyte(str string) bool +``` +IsMultibyte 字符串是否含有多字节字符. + +#### func (*LkkString) IsNumeric + +```go +func (ks *LkkString) IsNumeric(str string) bool +``` +IsNumeric 字符串是否数值(不包含复数和科学计数法). + +#### func (*LkkString) IsPhone + +```go +func (ks *LkkString) IsPhone(str string) bool +``` +IsPhone 是否电话号码(手机或固话). + +#### func (*LkkString) IsRgbColor + +```go +func (ks *LkkString) IsRgbColor(str string) bool +``` +IsRgbColor 检查字符串是否RGB颜色格式. + +#### func (*LkkString) IsRsaPublicKey + +```go +func (ks *LkkString) IsRsaPublicKey(str string, keylen uint16) bool +``` +IsRsaPublicKey 检查字符串是否RSA的公钥,keylen为密钥长度. + +#### func (*LkkString) IsSha1 + +```go +func (ks *LkkString) IsSha1(str string) bool +``` +IsSha1 是否Sha1值. + +#### func (*LkkString) IsSha256 + +```go +func (ks *LkkString) IsSha256(str string) bool +``` +IsSha256 是否Sha256值. + +#### func (*LkkString) IsSha512 + +```go +func (ks *LkkString) IsSha512(str string) bool +``` +IsSha512 是否Sha512值. + +#### func (*LkkString) IsTel + +```go +func (ks *LkkString) IsTel(str string) bool +``` +IsTel 是否固定电话或400/800电话. + +#### func (*LkkString) IsUpper + +```go +func (ks *LkkString) IsUpper(str string) bool +``` +IsUpper 字符串是否全部大写. + +#### func (*LkkString) IsUrl + +```go +func (ks *LkkString) IsUrl(str string) bool +``` +IsUrl 检查字符串是否URL. + +#### func (*LkkString) IsUrlExists + +```go +func (ks *LkkString) IsUrlExists(str string) bool +``` +IsUrlExists 检查URL是否存在. + +#### func (*LkkString) IsUtf8 + +```go +func (ks *LkkString) IsUtf8(s []byte) bool +``` +IsUtf8 字符串是否UTF-8编码. + +#### func (*LkkString) IsWhitespaces + +```go +func (ks *LkkString) IsWhitespaces(str string) bool +``` +IsWhitespaces 是否全部空白字符,不包括空字符串. + +#### func (*LkkString) IsWord + +```go +func (ks *LkkString) IsWord(str string) bool +``` +IsWord 是否词语(不以下划线开头的中文、英文、数字、下划线). + +#### func (*LkkString) JsonDecode + +```go +func (ks *LkkString) JsonDecode(str []byte, res interface{}) error +``` +JsonDecode 对 JSON 格式的str字符串进行解码,注意res使用指针. 依赖库github.com/json-iterator/go. + +#### func (*LkkString) JsonEncode + +```go +func (ks *LkkString) JsonEncode(val interface{}) ([]byte, error) +``` +JsonEncode 对val变量进行 JSON 编码. 依赖库github.com/json-iterator/go. + +#### func (*LkkString) Jsonp2Json + +```go +func (ks *LkkString) Jsonp2Json(str string) (string, error) +``` +Jsonp2Json 将jsonp转为json串. Example: forbar({a:"1",b:2}) to {"a":"1","b":2} + +#### func (*LkkString) LastIndex + +```go +func (ks *LkkString) LastIndex(str, sub string, ignoreCase bool) int +``` +LastIndex 查找子串sub在字符串str中最后一次出现的位置,不存在则返回-1; ignoreCase为是否忽略大小写. + +#### func (*LkkString) Lcfirst + +```go +func (ks *LkkString) Lcfirst(str string) string +``` +Lcfirst 将字符串的第一个字符转换为小写. + +#### func (*LkkString) Lcwords + +```go +func (ks *LkkString) Lcwords(str string) string +``` +Lcwords 将字符串中每个词的首字母转换为小写. + +#### func (*LkkString) Levenshtein + +```go +func (ks *LkkString) Levenshtein(a, b string) int +``` +Levenshtein 计算两个字符串之间的编辑距离,返回值越小字符串越相似. 注意字符串最大长度为255. + +#### func (*LkkString) Ltrim + +```go +func (ks *LkkString) Ltrim(str string, characterMask ...string) string +``` +Ltrim 删除字符串开头的空白字符(或其他字符). characterMask为要修剪的字符. + +#### func (*LkkString) MatchEquations + +```go +func (ks *LkkString) MatchEquations(str string) (res []string) +``` +MatchEquations 匹配字符串中所有的等式. + +#### func (*LkkString) MbStrlen + +```go +func (ks *LkkString) MbStrlen(str string) int +``` +MbStrlen 获取宽字符串的长度,多字节的字符被计为 1. + +#### func (*LkkString) MbSubstr + +```go +func (ks *LkkString) MbSubstr(str string, start int, length ...int) string +``` +MbSubstr 返回(宽字符)字符串str的子串. start 为起始位置.若值是负数,返回的结果将从 str 结尾处向前数第 abs(start) +个字符开始. length 为截取的长度.若值时负数, str 末尾处的 abs(length) 个字符将会被省略. +start/length的绝对值必须<=原字符串长度. + +#### func (*LkkString) Md5 + +```go +func (ks *LkkString) Md5(str string, length ...uint8) string +``` +Md5 获取字符串md5值. length指定结果长度,默认32. + +#### func (*LkkString) Md5Byte + +```go +func (ks *LkkString) Md5Byte(str []byte, length ...uint8) []byte +``` +Md5Byte 获取字节切片md5值. length指定结果长度,默认32. + +#### func (*LkkString) Nl2br + +```go +func (ks *LkkString) Nl2br(str string) string +``` +Nl2br 将换行符转换为br标签. + +#### func (*LkkString) Ord + +```go +func (ks *LkkString) Ord(char string) rune +``` +Ord 将首字符转换为rune(ASCII值). 注意:当字符串为空时返回65533. + +#### func (*LkkString) ParseStr + +```go +func (ks *LkkString) ParseStr(encodedString string, result map[string]interface{}) error +``` +ParseStr 将URI查询字符串转换为字典. + +#### func (*LkkString) ParseUrl + +```go +func (ks *LkkString) ParseUrl(str string, component int16) (map[string]string, error) +``` +ParseUrl 解析URL,返回其组成部分. component为需要返回的组成; -1: all; 1: scheme; 2: host; 4: port; +8: user; 16: pass; 32: path; 64: query; 128: fragment . + +#### func (*LkkString) PasswordSafeLevel + +```go +func (ks *LkkString) PasswordSafeLevel(str string) (res uint8) +``` +PasswordSafeLevel 检查密码安全等级;为0 极弱,为1 弱,为2 一般,为3 很好,为4 极佳. + +#### func (*LkkString) Quotemeta + +```go +func (ks *LkkString) Quotemeta(str string) string +``` +Quotemeta 转义元字符集,包括 . \ + * ? [ ^ ] ( $ )等. + +#### func (*LkkString) Random + +```go +func (ks *LkkString) Random(length uint8, rtype LkkRandString) string +``` +Random 生成随机字符串. length为长度,rtype为枚举: RAND_STRING_ALPHA 字母; RAND_STRING_NUMERIC +数值; RAND_STRING_ALPHANUM 字母+数值; RAND_STRING_SPECIAL 字母+数值+特殊字符; +RAND_STRING_CHINESE 仅中文. + +#### func (*LkkString) RawUrlDecode + +```go +func (ks *LkkString) RawUrlDecode(str string) (string, error) +``` +RawUrlDecode 对已编码的 URL 字符串进行解码. + +#### func (*LkkString) RawUrlEncode + +```go +func (ks *LkkString) RawUrlEncode(str string) string +``` +RawUrlEncode 按照 RFC 3986 对 URL 进行编码. + +#### func (*LkkString) RemoveAfter + +```go +func (ks *LkkString) RemoveAfter(str, after string, include, ignoreCase bool) string +``` +RemoveAfter 移除after之后的字符串; include为是否移除包括after本身; ignoreCase为是否忽略大小写. + +#### func (*LkkString) RemoveBefore + +```go +func (ks *LkkString) RemoveBefore(str, before string, include, ignoreCase bool) string +``` +RemoveBefore 移除before之前的字符串; include为是否移除包括before本身; ignoreCase为是否忽略大小写. + +#### func (*LkkString) RemoveEmoji + +```go +func (ks *LkkString) RemoveEmoji(str string) string +``` +RemoveEmoji 移除字符串中的表情符(使用正则,效率较低). + +#### func (*LkkString) RemoveSpace + +```go +func (ks *LkkString) RemoveSpace(str string, all bool) string +``` +RemoveSpace 移除字符串中的空白字符. all为true时移除全部空白,为false时只替换连续的空白字符为一个空格. + +#### func (*LkkString) Reverse + +```go +func (ks *LkkString) Reverse(str string) string +``` +Reverse 反转字符串. + +#### func (*LkkString) Rtrim + +```go +func (ks *LkkString) Rtrim(str string, characterMask ...string) string +``` +Rtrim 删除字符串末端的空白字符(或者其他字符). characterMask为要修剪的字符. + +#### func (*LkkString) SBC2DBC + +```go +func (ks *LkkString) SBC2DBC(s string) string +``` +SBC2DBC 全角转半角. + +#### func (*LkkString) Serialize + +```go +func (ks *LkkString) Serialize(val interface{}) ([]byte, error) +``` +Serialize 对变量进行序列化. + +#### func (*LkkString) ShaX + +```go +func (ks *LkkString) ShaX(str string, x uint16) string +``` +ShaX 计算字符串的 shaX 散列值,x为1/256/512 . + +#### func (*LkkString) ShaXByte + +```go +func (ks *LkkString) ShaXByte(str []byte, x uint16) []byte +``` +ShaXByte 计算字节切片的 shaX 散列值,x为1/256/512 . + +#### func (*LkkString) Shuffle + +```go +func (ks *LkkString) Shuffle(str string) string +``` +Shuffle 随机打乱字符串. + +#### func (*LkkString) SimilarText + +```go +func (ks *LkkString) SimilarText(first, second string) (res int, percent float64) +``` +SimilarText 计算两个字符串的相似度;返回在两个字符串中匹配字符的数目,以及相似程度百分数. + +#### func (*LkkString) StartsWith + +```go +func (ks *LkkString) StartsWith(str, sub string, ignoreCase bool) bool +``` +StartsWith 字符串str是否以sub开头. + +#### func (*LkkString) StartsWiths + +```go +func (ks *LkkString) StartsWiths(str string, subs []string, ignoreCase bool) (res bool) +``` +StartsWiths 字符串str是否以subs其中之一为开头. + +#### func (*LkkString) StrOffset + +```go +func (ks *LkkString) StrOffset(str string, num int) string +``` +StrOffset 字符串整体偏移. + +#### func (*LkkString) StripTags + +```go +func (ks *LkkString) StripTags(str string) string +``` +StripTags 过滤html标签. + +#### func (*LkkString) Stripos + +```go +func (ks *LkkString) Stripos(haystack, needle string, offset int) int +``` +Stripos 查找字符串首次出现的位置(不区分大小写),找不到时返回-1. haystack在该字符串中进行查找,needle要查找的字符串; +offset起始位置,为负数时时,搜索会从字符串结尾指定字符数开始. + +#### func (*LkkString) Stripslashes + +```go +func (ks *LkkString) Stripslashes(str string) string +``` +Stripslashes 反引用一个引用字符串. + +#### func (*LkkString) Strlen + +```go +func (ks *LkkString) Strlen(str string) int +``` +Strlen 获取字符串长度. + +#### func (*LkkString) Strpad + +```go +func (ks *LkkString) Strpad(str string, fill string, max int, ptype LkkPadType) string +``` +Strpad 使用fill填充str字符串到指定长度max. ptype为填充类型,枚举值(PAD_LEFT,PAD_RIGHT,PAD_BOTH). + +#### func (*LkkString) StrpadBoth + +```go +func (ks *LkkString) StrpadBoth(str string, fill string, max int) string +``` +StrpadBoth 字符串两侧填充,请参考Strpad. + +#### func (*LkkString) StrpadLeft + +```go +func (ks *LkkString) StrpadLeft(str string, fill string, max int) string +``` +StrpadLeft 字符串左侧填充,请参考Strpad. + +#### func (*LkkString) StrpadRight + +```go +func (ks *LkkString) StrpadRight(str string, fill string, max int) string +``` +StrpadRight 字符串右侧填充,请参考Strpad. + +#### func (*LkkString) Strpos + +```go +func (ks *LkkString) Strpos(haystack, needle string, offset int) int +``` +Strpos 查找字符串首次出现的位置,找不到时返回-1. haystack在该字符串中进行查找,needle要查找的字符串; +offset起始位置,为负数时时,搜索会从字符串结尾指定字符数开始. + +#### func (*LkkString) Strripos + +```go +func (ks *LkkString) Strripos(haystack, needle string, offset int) int +``` +Strripos 查找指定字符串在目标字符串中最后一次出现的位置(不区分大小写). + +#### func (*LkkString) Strrpos + +```go +func (ks *LkkString) Strrpos(haystack, needle string, offset int) int +``` +Strrpos 查找指定字符串在目标字符串中最后一次出现的位置. + +#### func (*LkkString) Substr + +```go +func (ks *LkkString) Substr(str string, start int, length ...int) string +``` +Substr 截取字符串str的子串. start 为起始位置.若值是负数,返回的结果将从 str 结尾处向前数第 abs(start) 个字符开始. +length 为截取的长度.若值时负数, str 末尾处的 abs(length) 个字符将会被省略. start/length的绝对值必须<=原字符串长度. + +#### func (*LkkString) SubstrCount + +```go +func (ks *LkkString) SubstrCount(str, substr string) int +``` +SubstrCount 计算子串substr在字符串str中出现的次数,区分大小写. + +#### func (*LkkString) SubstriCount + +```go +func (ks *LkkString) SubstriCount(str, substr string) int +``` +SubstriCount 计算子串substr在字符串str中出现的次数,忽略大小写. + +#### func (*LkkString) ToCamelCase + +```go +func (ks *LkkString) ToCamelCase(str string) string +``` +ToCamelCase 转为驼峰写法. 去掉包括下划线"_"和横杠"-". + +#### func (*LkkString) ToKebabCase + +```go +func (ks *LkkString) ToKebabCase(str string) string +``` +ToKebabCase 转为串形写法. 使用横杠"-"连接. + +#### func (*LkkString) ToRunes + +```go +func (ks *LkkString) ToRunes(str string) []rune +``` +ToRunes 将字符串转为字符切片. + +#### func (*LkkString) ToSnakeCase + +```go +func (ks *LkkString) ToSnakeCase(str string) string +``` +ToSnakeCase 转为蛇形写法. 使用下划线"_"连接. + +#### func (*LkkString) Trim + +```go +func (ks *LkkString) Trim(str string, characterMask ...string) string +``` +Trim 去除字符串首尾处的空白字符(或者其他字符). characterMask为要修剪的字符. + +#### func (*LkkString) TrimBOM + +```go +func (ks *LkkString) TrimBOM(str []byte) []byte +``` +TrimBOM 移除字符串中的BOM + +#### func (*LkkString) Ucfirst + +```go +func (ks *LkkString) Ucfirst(str string) string +``` +Ucfirst 将字符串的第一个字符转换为大写. + +#### func (*LkkString) Ucwords + +```go +func (ks *LkkString) Ucwords(str string) string +``` +Ucwords 将字符串中每个词的首字母转换为大写. + +#### func (*LkkString) UnSerialize + +```go +func (ks *LkkString) UnSerialize(data []byte, register ...interface{}) (val interface{}, err error) +``` +UnSerialize 对字符串进行反序列化. 其中register注册对象,其类型必须和Serialize的一致. + +#### func (*LkkString) Uniqid + +```go +func (ks *LkkString) Uniqid(prefix string) string +``` +Uniqid 获取一个带前缀的唯一ID(24位). prefix 为前缀字符串. + +#### func (*LkkString) UrlDecode + +```go +func (ks *LkkString) UrlDecode(str string) (string, error) +``` +UrlDecode 解码已编码的 URL 字符串. + +#### func (*LkkString) UrlEncode + +```go +func (ks *LkkString) UrlEncode(str string) string +``` +UrlEncode 编码 URL 字符串. + +#### func (*LkkString) Utf8ToBig5 + +```go +func (ks *LkkString) Utf8ToBig5(s []byte) ([]byte, error) +``` +Utf8ToBig5 UTF-8转BIG5编码. + +#### func (*LkkString) Utf8ToGbk + +```go +func (ks *LkkString) Utf8ToGbk(s []byte) ([]byte, error) +``` +Utf8ToGbk UTF-8转GBK编码. + +#### func (*LkkString) UuidV4 + +```go +func (ks *LkkString) UuidV4() (string, error) +``` +UuidV4 获取36位UUID(Version4,RFC4122). + +#### func (*LkkString) UuidV5 + +```go +func (ks *LkkString) UuidV5(name, namespace []byte) (string, error) +``` +UuidV5 根据提供的字符,使用sha1生成36位哈希值(Version5,RFC4122); name为要计算散列值的字符,可以为nil; +namespace为命名空间,长度必须为16. + +#### func (*LkkString) VersionCompare + +```go +func (ks *LkkString) VersionCompare(version1, version2, operator string) (bool, error) +``` +VersionCompare 对比两个版本号字符串. operator允许的操作符有: <, lt, <=, le, >, gt, >=, ge, ==, =, +eq, !=, <>, ne . 特定的版本字符串,将会用以下顺序处理: 无 < dev < alpha = a < beta = b < RC = rc < +# < pl = p < ga < release = r 用法: VersionCompare("1.2.3-alpha", "1.2.3RC7", +'>=') ; VersionCompare("1.2.3-beta", "1.2.3pl", 'lt') ; +VersionCompare("1.1_dev", "1.2any", 'eq') . + +#### type LkkTime + +```go +type LkkTime struct { +} +``` + +LkkTime is the receiver of time utilities + +#### func (*LkkTime) CheckDate + +```go +func (kt *LkkTime) CheckDate(year, month, day int) bool +``` +CheckDate 检查是否正常的日期. + +#### func (*LkkTime) Date + +```go +func (kt *LkkTime) Date(format string, ts ...interface{}) string +``` +Date 格式化时间. format 格式,如"Y-m-d H:i:s". ts为int/int64类型时间戳或time.Time类型. + +#### func (*LkkTime) Day + +```go +func (kt *LkkTime) Day(t ...time.Time) int +``` +Day 获取日份. + +#### func (*LkkTime) DaysBetween + +```go +func (kt *LkkTime) DaysBetween(fromDate, toDate time.Time) int +``` +DaysBetween 获取两个日期的间隔天数. fromDate 为开始时间,toDate 为终点时间. + +#### func (*LkkTime) EndOfDay + +```go +func (kt *LkkTime) EndOfDay(date time.Time) time.Time +``` +EndOfDay 获取日期中当天的结束时间. + +#### func (*LkkTime) EndOfMonth + +```go +func (kt *LkkTime) EndOfMonth(date time.Time) time.Time +``` +EndOfMonth 获取日期中当月的结束时间. + +#### func (*LkkTime) EndOfWeek + +```go +func (kt *LkkTime) EndOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time +``` +EndOfWeek 获取日期中当周的结束时间; weekStartDay 周几作为周的第一天,本库默认周一. + +#### func (*LkkTime) EndOfYear + +```go +func (kt *LkkTime) EndOfYear(date time.Time) time.Time +``` +EndOfYear 获取日期中当年的结束时间. + +#### func (*LkkTime) GetMonthDays + +```go +func (kt *LkkTime) GetMonthDays(month int, year ...int) (days int) +``` +GetMonthDays 获取指定月份的天数.year年份,可选,默认当前年份. + +#### func (*LkkTime) Hour + +```go +func (kt *LkkTime) Hour(t ...time.Time) int +``` +Hour 获取小时. + +#### func (*LkkTime) IsDate2time + +```go +func (kt *LkkTime) IsDate2time(str string) (bool, int64) +``` +IsDate2time 检查字符串是否日期格式,并转换为时间戳.注意,时间戳可能为负数(小于1970年时). 匹配如: + + 0000 + 0000-00 + 0000/00 + 0000-00-00 + 0000/00/00 + 0000-00-00 00 + 0000/00/00 00 + 0000-00-00 00:00 + 0000/00/00 00:00 + 0000-00-00 00:00:00 + 0000/00/00 00:00:00 + +等日期格式. + +#### func (*LkkTime) MicroTime + +```go +func (kt *LkkTime) MicroTime() int64 +``` +MicroTime 获取当前Unix时间戳(微秒,16位). + +#### func (*LkkTime) MilliTime + +```go +func (kt *LkkTime) MilliTime() int64 +``` +MilliTime 获取当前Unix时间戳(毫秒,13位). + +#### func (*LkkTime) Minute + +```go +func (kt *LkkTime) Minute(t ...time.Time) int +``` +Minute 获取分钟. + +#### func (*LkkTime) Month + +```go +func (kt *LkkTime) Month(t ...time.Time) int +``` +Month 获取月份. + +#### func (*LkkTime) Second + +```go +func (kt *LkkTime) Second(t ...time.Time) int +``` +Second 获取秒数. + +#### func (*LkkTime) ServiceStartime + +```go +func (kt *LkkTime) ServiceStartime() int64 +``` +ServiceStartime 获取当前服务启动时间戳,秒. + +#### func (*LkkTime) ServiceUptime + +```go +func (kt *LkkTime) ServiceUptime() time.Duration +``` +ServiceUptime 获取当前服务运行时间,纳秒int64. + +#### func (*LkkTime) Sleep + +```go +func (kt *LkkTime) Sleep(t int64) +``` +Sleep 延缓执行,秒. + +#### func (*LkkTime) StartOfDay + +```go +func (kt *LkkTime) StartOfDay(date time.Time) time.Time +``` +StartOfDay 获取日期中当天的开始时间. + +#### func (*LkkTime) StartOfMonth + +```go +func (kt *LkkTime) StartOfMonth(date time.Time) time.Time +``` +StartOfMonth 获取日期中当月的开始时间. + +#### func (*LkkTime) StartOfWeek + +```go +func (kt *LkkTime) StartOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time +``` +StartOfWeek 获取日期中当周的开始时间; weekStartDay 周几作为周的第一天,本库默认周一. + +#### func (*LkkTime) StartOfYear + +```go +func (kt *LkkTime) StartOfYear(date time.Time) time.Time +``` +StartOfYear 获取日期中当年的开始时间. + +#### func (*LkkTime) Str2Timestamp + +```go +func (kt *LkkTime) Str2Timestamp(str string, format ...string) (int64, error) +``` +Str2Timestamp 将字符串转换为时间戳,秒. str 为要转换的字符串; format 为该字符串的格式,默认为"2006-01-02 +15:04:05" . + +#### func (*LkkTime) Str2Timestruct + +```go +func (kt *LkkTime) Str2Timestruct(str string, format ...string) (time.Time, error) +``` +Str2Timestruct 将字符串转换为时间结构. str 为要转换的字符串; format 为该字符串的格式,默认为"2006-01-02 +15:04:05" . + +#### func (*LkkTime) UnixTime + +```go +func (kt *LkkTime) UnixTime() int64 +``` +UnixTime 获取当前Unix时间戳(秒,10位). + +#### func (*LkkTime) Usleep + +```go +func (kt *LkkTime) Usleep(t int64) +``` +Usleep 以指定的微秒数延迟执行. + +#### func (*LkkTime) Year + +```go +func (kt *LkkTime) Year(t ...time.Time) int +``` +Year 获取年份. + +#### type SystemInfo + +```go +type SystemInfo struct { + ServerName string `json:"server_name"` //服务器名称 + SystemArch string `json:"system_arch"` //系统架构 + SystemOs string `json:"system_os"` //操作系统名称 + Runtime uint64 `json:"run_time"` //服务运行时间,纳秒 + Uptime uint64 `json:"up_time"` //操作系统运行时间,秒 + GoroutineNum int `json:"goroutine_num"` //goroutine数量 + CpuNum int `json:"cpu_num"` //cpu核数 + CpuUser float64 `json:"cpu_user"` //cpu用户态比率 + CpuFree float64 `json:"cpu_free"` //cpu空闲比率 + DiskUsed uint64 `json:"disk_used"` //已用磁盘空间,字节数 + DiskFree uint64 `json:"disk_free"` //可用磁盘空间,字节数 + DiskTotal uint64 `json:"disk_total"` //总磁盘空间,字节数 + MemUsed uint64 `json:"mem_used"` //已用内存,字节数 + MemSys uint64 `json:"mem_sys"` //系统内存占用量,字节数 + MemFree uint64 `json:"mem_free"` //剩余内存,字节数 + MemTotal uint64 `json:"mem_total"` //总内存,字节数 + AllocGolang uint64 `json:"alloc_golang"` //golang内存使用量,字节数 + AllocTotal uint64 `json:"alloc_total"` //总分配的内存,字节数 + Lookups uint64 `json:"lookups"` //指针查找次数 + Mallocs uint64 `json:"mallocs"` //内存分配次数 + Frees uint64 `json:"frees"` //内存释放次数 + LastGCTime uint64 `json:"last_gc_time"` //上次GC时间,纳秒 + NextGC uint64 `json:"next_gc"` //下次GC内存回收量,字节数 + PauseTotalNs uint64 `json:"pause_total_ns"` //GC暂停时间总量,纳秒 + PauseNs uint64 `json:"pause_ns"` //上次GC暂停时间,纳秒 +} +``` + +SystemInfo 系统信息 + +#### type Win32_Process + +```go +type Win32_Process struct { + Name string + ExecutablePath *string + CommandLine *string + Priority uint32 + CreationDate *time.Time + ProcessId uint32 + ThreadCount uint32 + Status *string + ReadOperationCount uint64 + ReadTransferCount uint64 + WriteOperationCount uint64 + WriteTransferCount uint64 + CSCreationClassName string + CSName string + Caption *string + CreationClassName string + Description *string + ExecutionState *uint16 + HandleCount uint32 + KernelModeTime uint64 + MaximumWorkingSetSize *uint32 + MinimumWorkingSetSize *uint32 + OSCreationClassName string + OSName string + OtherOperationCount uint64 + OtherTransferCount uint64 + PageFaults uint32 + PageFileUsage uint32 + ParentProcessID uint32 + PeakPageFileUsage uint32 + PeakVirtualSize uint64 + PeakWorkingSetSize uint32 + PrivatePageCount uint64 + TerminationDate *time.Time + UserModeTime uint64 + WorkingSetSize uint64 +} +``` diff --git a/kgo.go b/kgo.go index 17348f4..6880899 100644 --- a/kgo.go +++ b/kgo.go @@ -61,7 +61,7 @@ type ( const ( // Version 版本号 - Version = "0.4.0" + Version = "0.4.1" // KDelimiter 本库自定义分隔符 KDelimiter = "$@#KSYSK#@$"