gstring

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NonceSymbols 随机字符串可用字符集
	NonceSymbols = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// NonceLength 随机字符串的长度
	NonceLength = 32
)

Variables

This section is empty.

Functions

func AppendArg

func AppendArg(b []byte, v interface{}) []byte

func Bytes

func Bytes(s string) []byte

Bytes converts string to byte slice.

func CodeToIDBase34

func CodeToIDBase34(idByte []byte) (uint64, error)

CodeToIDBase34 -- 将code逆向转换成原始id

func CodeToIDReverse added in v0.4.0

func CodeToIDReverse(code string) (int64, error)

CodeToIDReverse -- 将code逆向转换成原始id

func Contains

func Contains(target interface{}, obj interface{}) bool

Contains fun

func ContainsString

func ContainsString(slice []string, item string) bool

ContainsString fun

func GenCodeBase34

func GenCodeBase34(id uint64) []byte

GenCodeBase34 -- 将id转换成6位长度的code

func GenCodeReverse added in v0.4.0

func GenCodeReverse(id int64) string

GenCodeReverse 将id转换成n位长度的code

func GenerateNonce added in v0.4.7

func GenerateNonce() (string, error)

GenerateNonce 生成一个长度为 NonceLength 的随机字符串(只包含大小写字母与数字)

func GenerateNonceLength added in v0.4.7

func GenerateNonceLength(Length int) (string, error)

GenerateNonceLength 生成一个长度为 Length 的随机字符串(只包含大小写字母与数字)

func IntToStringArray added in v0.4.7

func IntToStringArray(arr []int) []string

func Join

func Join(elems []string, sep string) string

Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

func Len added in v0.4.4

func Len(str string) int

Len 字符串长度,包括控制码,一个汉字长度1

func LowercaseFirst

func LowercaseFirst(str string) string

LowercaseFirst fun

func NewLine

func NewLine() string

NewLine new line

func PadLeft

func PadLeft(s string, pad string, plength int) string

PadLeft fun

func RandomString

func RandomString(length int) string

RandomString fun

func RemoveRepeatSlice added in v0.4.7

func RemoveRepeatSlice(slc []string) []string

RemoveRepeatSlice 元素去重

func RemoveRepeatSliceInt added in v0.4.7

func RemoveRepeatSliceInt(slc []int) []int

RemoveRepeatSliceInt 元素去重

func Reverse added in v0.4.0

func Reverse(x int64) int64

Reverse 字符串翻转

func String

func String(b []byte) string

String converts byte slice to string.

func StringToIntArray added in v0.4.7

func StringToIntArray(arr []string) []int

func Sub

func Sub(str string, start int, length int) string

Sub fun

func SubString added in v0.4.7

func SubString(str string, begin, length int) string

func UppercaseFirst

func UppercaseFirst(str string) string

UppercaseFirst fun

Types

This section is empty.

Jump to

Keyboard shortcuts

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