gostring

package module
v1.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 17 Imported by: 17

Documentation

Index

Constants

View Source
const Version = "1.0.21"

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

func CompleteUrlHttp

func CompleteUrlHttp(url string) string

CompleteUrlHttp 补全 URL

func CompleteUrlHttps

func CompleteUrlHttps(url string) string

CompleteUrlHttps 补全 URL

func Contains

func Contains(s, sep string) bool

Contains 判断字符串是否包含某个字符

func GenerateId

func GenerateId(customId string) string

GenerateId 生成18位编号

func GenerateIdAndTime

func GenerateIdAndTime(customId, customTime string) string

GenerateIdAndTime 生成18位编号

func GenerateIdAndTimeLength

func GenerateIdAndTimeLength(customId, customTime string, dataLength int) string

GenerateIdAndTimeLength 生成自定义长度编号

func GenerateIdLength

func GenerateIdLength(customId string, dataLength int) string

GenerateIdLength 生成自定义长度编号

func GenerateRandom

func GenerateRandom(length, count int) []int

GenerateRandom 生成count个长度length不重复的随机数

func GenerateRandomFunc

func GenerateRandomFunc(length, count int, dFun func(num int) bool) []int

GenerateRandomFunc 生成count个长度length不重复的随机数,支持外部查询

func GenerateRandomNumber

func GenerateRandomNumber(start, end, count int, dFun func(num int) bool) []int

GenerateRandomNumber 生成count个[start,end)结束的不重复的随机数

func GenerateRandomString

func GenerateRandomString(length, count int) []string

GenerateRandomString 生成count个长度length不重复的随机数

func GenerateRandomStringFunc

func GenerateRandomStringFunc(length, count int, dFun func(num string) bool) []string

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 GetDefault(key, defVal any) any

func GetString

func GetString(i interface{}) string

func GetStringDefault

func GetStringDefault(key, defVal string) string

func GetUuId

func GetUuId() string

GetUuId 由 32 个十六进制数字组成,以 6 个组显示,由连字符 - 分隔

func HmacSha256Hex

func HmacSha256Hex(key, strToSign string) string

func IsNotChinese added in v1.0.21

func IsNotChinese(s string) bool

IsNotChinese 检查字符串包含中文字符 则返回 true;否则返回 false。

func IsNotChineseOrDigit added in v1.0.21

func IsNotChineseOrDigit(s string) bool

IsNotChineseOrDigit 检查字符串包含中文字符或数字字符 则返回 true;否则返回 false。

func IsNotDigit added in v1.0.21

func IsNotDigit(s string) bool

IsNotDigit 检查字符串数字字符 则返回 true;否则返回 false。

func LineBreak

func LineBreak(str string) string

LineBreak 去除换行符

func NumericalToString

func NumericalToString(value interface{}) (string, bool)

func Replace

func Replace(str, old, new string) string

Replace 字符串替换

func Space

func Space(str string) string

Space 去除空格

func SpaceAndLineBreak

func SpaceAndLineBreak(str string) string

SpaceAndLineBreak 去除空格和去除换行符

func Split

func Split(s string, sep string) []string

Split 字符串分隔

func StringToBytes

func StringToBytes(s string) []byte

func ToFloat64

func ToFloat64(s string) float64

ToFloat64 string到float64

func ToInt

func ToInt(s string) int

ToInt string到int

func ToInt64

func ToInt64(s string) int64

ToInt64 string到int64

func ToLower

func ToLower(s string) string

ToLower 转小写

func ToString

func ToString(value interface{}) string

ToString 转换成string

func ToUint

func ToUint(s string) uint

ToUint string到uint64

func ToUint64

func ToUint64(s string) uint64

ToUint64 string到uint64

func ToUpper

func ToUpper(s string) string

ToUpper 转大写

func TrimLastChar

func TrimLastChar(s string) string

TrimLastChar 删除字符串中的最后一个

Types

type Only

type Only struct {
}

func NewOnly

func NewOnly() *Only

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL