str

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrNumberic    = `0123456789`
	StrLowercase   = `abcdefghijklmnopqrstuvwxyz`
	StrCapital     = `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
	StrPunctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
)

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(str string) string

字符串转为驼峰

func CamelCaseLowerFirst

func CamelCaseLowerFirst(str string) string

字符串转为驼峰(首字母小写)

func DecodeStrFromBase64

func DecodeStrFromBase64(str string) string

解密base64字符串

func EncodeStr2Base64

func EncodeStr2Base64(str string) string

加密base64字符串

func Rand

func Rand(args ...interface{}) string

Rand 默认随机生成6-32位的随机字符串(长度类型皆随机) 如果传入不同的参数,则分别对应不同的函数

func RandAll

func RandAll(length ...int) string

func RandBetween

func RandBetween(min, max int) int

func RandCapital

func RandCapital(length ...int) string

func RandCustom

func RandCustom(length int, source string) string

func RandLowercase

func RandLowercase(length ...int) string

func RandNumberic

func RandNumberic(length ...int) string

func RandString

func RandString(length ...int) string

func Random

func Random(length int, fill ...RandType) string

Random 随机生成指定长度的随机字符串(类型可选或随机)

func RandomBetween

func RandomBetween(min, max int, fill ...RandType) string

RandomBetween 随机生成指定长度区间的随机字符串(类型可选或随机)

func SnakeCase

func SnakeCase(str string) string

驼峰式写法转为下划线蛇形写法

func Str2Bool

func Str2Bool(str string) bool

字符串转uint

func Str2Float64

func Str2Float64(str string) float64

字符串转float64

func Str2Int

func Str2Int(str string) int

字符串转int

func Str2Uint

func Str2Uint(str string) uint

字符串转uint

func Str2Uint32

func Str2Uint32(str string) uint32

字符串转uint

func Str2UintArr

func Str2UintArr(str string) (ids []uint)

字符串转uint数组, 默认逗号分割

func StrIsEmpty

func StrIsEmpty(str string) bool

是否空字符串

func UintArr2IntArr

func UintArr2IntArr(arr []uint) (newArr []int)

字符串转uint数组, 默认逗号分割

Types

type RandType

type RandType int

RandType ...

const (
	// 大写字母
	T_CAPITAL RandType = iota + 1
	// 小写字母
	T_LOWERCASE
	// 数字
	T_NUMBERIC
	// 小写字母+数字
	T_LOWERCASE_NUMBERIC
	// 大写字母+数字
	T_CAPITAL_NUMBERIC
	// 大写字母+小写字母
	T_CAPITAL_LOWERCASE
	// 数字+字母
	T_ALL
)

func (RandType) String

func (rt RandType) String() string

Jump to

Keyboard shortcuts

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