Documentation ¶
Index ¶
- Constants
- func BytesToString(b []byte) string
- func CompleteUrlHttp(url string) string
- func CompleteUrlHttps(url string) string
- func Contains(s, sep string) bool
- func GenerateId(customId string) string
- func GenerateIdAndTime(customId, customTime string) string
- func GenerateIdAndTimeLength(customId, customTime string, dataLength int) string
- func GenerateIdLength(customId string, dataLength int) string
- func GenerateRandom(length, count int) []int
- func GenerateRandomFunc(length, count int, dFun func(num int) bool) []int
- func GenerateRandomNumber(start, end, count int, dFun func(num int) bool) []int
- func GenerateRandomString(length, count int) []string
- func GenerateRandomStringFunc(length, count int, dFun func(num string) bool) []string
- func GenerateRandomStringNumber(start, end, count int, alphabet string, length int, dFun func(num string) bool) []string
- func GetDefault(key, defVal any) any
- func GetString(i interface{}) string
- func GetStringDefault(key, defVal string) string
- func GetUuId() string
- func HmacSha256Hex(key, strToSign string) string
- func IsNotChinese(s string) bool
- func IsNotChineseOrDigit(s string) bool
- func IsNotDigit(s string) bool
- func LineBreak(str string) string
- func NumericalToString(value interface{}) (string, bool)
- func Replace(str, old, new string) string
- func Space(str string) string
- func SpaceAndLineBreak(str string) string
- func Split(s string, sep string) []string
- func StringToBytes(s string) []byte
- func ToFloat64(s string) float64
- func ToInt(s string) int
- func ToInt64(s string) int64
- func ToLower(s string) string
- func ToString(value interface{}) string
- func ToUint(s string) uint
- func ToUint64(s string) uint64
- func ToUpper(s string) string
- func TrimLastChar(s string) string
- func TruncateStringRune(s string, maxLength int) string
- type Only
Constants ¶
View Source
const Version = "1.0.22"
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func GenerateIdAndTime ¶
GenerateIdAndTime 生成18位编号
func GenerateIdAndTimeLength ¶
GenerateIdAndTimeLength 生成自定义长度编号
func GenerateIdLength ¶
GenerateIdLength 生成自定义长度编号
func GenerateRandom ¶
GenerateRandom 生成count个长度length不重复的随机数
func GenerateRandomFunc ¶
GenerateRandomFunc 生成count个长度length不重复的随机数,支持外部查询
func GenerateRandomNumber ¶
GenerateRandomNumber 生成count个[start,end)结束的不重复的随机数
func GenerateRandomString ¶
GenerateRandomString 生成count个长度length不重复的随机数
func GenerateRandomStringFunc ¶
GenerateRandomStringFunc 生成count个长度length不重复的随机数,支持外部查询
func GenerateRandomStringNumber ¶
func GenerateRandomStringNumber(start, end, count int, alphabet string, length int, dFun func(num string) bool) []string
GenerateRandomStringNumber 生成count个[start,end)结束的不重复的随机数
func GetDefault ¶
func GetStringDefault ¶
func HmacSha256Hex ¶
func IsNotChinese ¶ added in v1.0.21
IsNotChinese 检查字符串包含中文字符 则返回 true;否则返回 false。
func IsNotChineseOrDigit ¶ added in v1.0.21
IsNotChineseOrDigit 检查字符串包含中文字符或数字字符 则返回 true;否则返回 false。
func IsNotDigit ¶ added in v1.0.21
IsNotDigit 判断字符串是否包含数字字符
参数:
s string: 要判断的字符串
返回值:
bool: 如果字符串中包含数字字符,则返回true;否则返回false
说明:
该函数遍历字符串s中的每个字符,使用unicode.IsDigit函数判断字符是否为数字。 如果找到任何一个数字字符,则返回true;如果遍历完整个字符串后仍未找到数字字符,则返回false。
func NumericalToString ¶
func StringToBytes ¶
func TruncateStringRune ¶ added in v1.0.22
TruncateStringRune 截断字符串
参数:
s string: 要截断的字符串 maxLength int: 截断后的最大长度
返回值:
string: 截断后的字符串
说明:
该函数将字符串s截断为最多maxLength个字符,如果字符串s的长度小于等于maxLength,则返回原字符串; 否则返回前maxLength个字符组成的字符串。注意这里是按rune(Unicode码点)来截断,而不是按字节。
Types ¶
Click to show internal directories.
Click to hide internal directories.