stringx

package
v0.0.0-...-8c32fbf Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: AGPL-3.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllControl

func AllControl(s string) bool

func AllDigit

func AllDigit(s string) bool

func AllGraphic

func AllGraphic(s string) bool

func AllLetter

func AllLetter(s string) bool

func AllLetterOrDigit

func AllLetterOrDigit(s string) bool

func AllLower

func AllLower(s string) bool

func AllMark

func AllMark(s string) bool

func AllPrint

func AllPrint(s string) bool

func AllPunct

func AllPunct(s string) bool

func AllSpace

func AllSpace(s string) bool

func AllSymbol

func AllSymbol(s string) bool

func AllTitle

func AllTitle(s string) bool

func AllUpper

func AllUpper(s string) bool

func Camel2Snake

func Camel2Snake(s string) string

Camel2Snake 驼峰转蛇形 - 内存优化版本

func HasControl

func HasControl(s string) bool

func HasDigit

func HasDigit(s string) bool

func HasGraphic

func HasGraphic(s string) bool

func HasLetter

func HasLetter(s string) bool

func HasLetterOrDigit

func HasLetterOrDigit(s string) bool

func HasLower

func HasLower(s string) bool

func HasMark

func HasMark(s string) bool

func HasPrint

func HasPrint(s string) bool

func HasPunct

func HasPunct(s string) bool

func HasSpace

func HasSpace(s string) bool

func HasSymbol

func HasSymbol(s string) bool

func HasTitle

func HasTitle(s string) bool

func HasUpper

func HasUpper(s string) bool

func IsDigit

func IsDigit[M string | []rune](r M) bool

func IsUpper

func IsUpper[M string | []rune](r M) bool

func Quote

func Quote(s string) string

func QuotePure

func QuotePure(s string) string

func RandLetterNumbers

func RandLetterNumbers(n int) string

func RandLetters

func RandLetters(n int) string

func RandLowerLetterNumbers

func RandLowerLetterNumbers(n int) string

func RandLowerLetters

func RandLowerLetters(n int) string

func RandNumbers

func RandNumbers(n int) string

func RandStringWithSeed

func RandStringWithSeed(n int, seed []rune) string

func RandUpperLetterNumbers

func RandUpperLetterNumbers(n int) string

func RandUpperLetters

func RandUpperLetters(n int) string

func Reverse

func Reverse(s string) string

func SecureRandBytes

func SecureRandBytes(n int) ([]byte, error)

SecureRandBytes 生成指定长度的安全随机字节序列 使用 crypto/rand 生成密码学安全的随机数

func SecureRandHex

func SecureRandHex(n int) (string, error)

SecureRandHex 生成指定长度的安全随机十六进制字符串 适用于生成token、密钥等

func SecureRandLetterNumbers

func SecureRandLetterNumbers(n int) (string, error)

SecureRandLetterNumbers 生成指定长度的安全随机字母数字字符串(大小写混合)

func SecureRandLetters

func SecureRandLetters(n int) (string, error)

SecureRandLetters 生成指定长度的安全随机字母字符串(大小写混合) 使用 crypto/rand 生成,适用于密码、验证码等安全场景

func SecureRandLowerLetterNumbers

func SecureRandLowerLetterNumbers(n int) (string, error)

SecureRandLowerLetterNumbers 生成指定长度的安全随机小写字母数字字符串

func SecureRandLowerLetters

func SecureRandLowerLetters(n int) (string, error)

SecureRandLowerLetters 生成指定长度的安全随机小写字母字符串

func SecureRandNumbers

func SecureRandNumbers(n int) (string, error)

SecureRandNumbers 生成指定长度的安全随机数字字符串

func SecureRandString

func SecureRandString(n int) (string, error)

SecureRandString 生成指定长度的安全随机字符串(base64编码) 适用于生成会话ID、临时密钥等安全敏感场景

func SecureRandUpperLetterNumbers

func SecureRandUpperLetterNumbers(n int) (string, error)

SecureRandUpperLetterNumbers 生成指定长度的安全随机大写字母数字字符串

func SecureRandUpperLetters

func SecureRandUpperLetters(n int) (string, error)

SecureRandUpperLetters 生成指定长度的安全随机大写字母字符串

func Shorten

func Shorten(s string, max int) string

Shorten 缩短字符串

func ShortenShow

func ShortenShow(s string, max int) string

func Snake2Camel

func Snake2Camel(s string) string

Snake2Camel 蛇形转驼峰

func Snake2SmallCamel

func Snake2SmallCamel(s string) string

Snake2SmallCamel 蛇形转小驼峰

func SplitLen

func SplitLen(s string, max int) []string

SplitLen 按长度分割字符串 - 零拷贝优化版本

func ToBytes

func ToBytes(s string) []byte

func ToCamel

func ToCamel(s string) string

ToCamel 转驼峰

func ToDot

func ToDot(s string) string

func ToKebab

func ToKebab(s string) string

ToKebab - 基于优化ToSnake的变体

func ToSlash

func ToSlash(s string) string

func ToSmallCamel

func ToSmallCamel(s string) string

ToSmallCamel 转小驼峰

func ToSnake

func ToSnake(s string) string

ToSnake 蛇形 - 零分配优化版本

func ToString

func ToString(b []byte) string

func Utf16Len

func Utf16Len[M string | []rune | []byte](str M) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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