工具辅助类方法
- Source
Methods
(static) asciiToHex(str)
ASCII可视字符串转小写十六进制字符串
Parameters:
Name | Type | Description |
---|---|---|
str | string | ASCII可视字符串 |
- Source
Returns:
小写十六进制字符串
(static) base64ToUtf8(str)
Base64解码转UTF8字符串
Parameters:
Name | Type | Description |
---|---|---|
str | string | Base64编码字符串 |
- Source
Returns:
UTF8字符串 遇到异常返回参数原数据
(static) bswap16()
16位数值字节序反转
- Source
(static) bswap32()
32位数值字节序反转
- Source
(static) compareVersion(ver1, ver2, radix) → {number}
比较两个字符串版本号
Parameters:
Name | Type | Description |
---|---|---|
ver1 | string | 格式'xxx.xx.xx...' |
ver2 | string | 格式'xxx.xx.xx...' |
radix | number | 默认十进制 |
- Source
Returns:
0=ver1=ver2 -1=ver1<ver2 1=ver1>ver2
- Type:
- number
(static) deepFreeze()
深度递归冻结对象
- Source
(static) getChars(char, count) → {string}
获取指定数量重复字符
Parameters:
Name | Type | Description |
---|---|---|
char | string | 字符 |
count | number | 重复数量 |
- Source
Returns:
- Type:
- string
(static) hexToAscii(hex)
十六进制字符串转ASCII可视字符串
Parameters:
Name | Type | Description |
---|---|---|
hex | string | 十六进制字符串 |
- Source
Returns:
ASCII可视字符串
(static) hexToUtf8(hex)
十六进制字符串转UTF8字符串
Parameters:
Name | Type | Description |
---|---|---|
hex | string | 十六进制字符串 |
- Source
Returns:
UTF8字符串
(static) moneyToStr(money) → {string}
数值金额转字符串金额(单位分)
Parameters:
Name | Type | Description |
---|---|---|
money | number | 以分为单位的正负数值 |
- Source
Returns:
- Type:
- string
(static) reverseBits(num, bitSize)
二进制位反转
Parameters:
Name | Type | Description |
---|---|---|
num | number | 数值 |
bitSize | number | 有效位大小 |
- Source
(static) sliceCount(str, count) → {Array}
依据字符数量切片字符串
Parameters:
Name | Type | Description |
---|---|---|
str | string | 完整字符串 |
count | number | 字符数量 |
- Source
Returns:
切片后的字符串数组 参数错误返回空数组
- Type:
- Array
(static) sliceCountToInt(str, count, radix) → {Array}
依据字符数量切片字符串并进制转换为数值
Parameters:
Name | Type | Description |
---|---|---|
str | string | 完整字符串 |
count | number | 字符数量 |
radix | number | 字符串的进制 |
- Source
Returns:
切片后的数值数组 参数错误返回空数组
- Type:
- Array
(static) strToMoney(str) → {number}
字符串金额转数值金额(单位分)
Parameters:
Name | Type | Description |
---|---|---|
str | string | 以分为单位的字符串金额 |
- Source
Returns:
字符串格式异常返回null
- Type:
- number
(static) trimHex(str) → {string}
修剪清理影响HEX字符串的格式美化字符
Parameters:
Name | Type | Description |
---|---|---|
str | string |
- Source
Returns:
- Type:
- string
(static) uint32Add()
32位无符号数加法运算
- Source
(static) uint32Mul()
32位无符号数乘法运算
- Source
(static) uint32Sub()
32位无符号数减法运算
- Source
(static) utf8ToBase64(str)
UTF8字符串转Base64编码
Parameters:
Name | Type | Description |
---|---|---|
str | string | UTF8字符串 |
- Source
Returns:
Base64编码字符串 遇到异常返回参数原数据
(static) utf8ToHex(str)
UTF8字符串转小写十六进制字符串
Parameters:
Name | Type | Description |
---|---|---|
str | string | UTF8字符串 |
- Source
Returns:
小写十六进制字符串