str

package
v0.0.0-...-b262f20 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearChineseText

func ClearChineseText(text string, punctuationMap map[rune]rune) string

文本清理

如果英文符号前后都是中文,则替换为中文符号
并移除前后和中间的多余空字符串

func ClearPersonName

func ClearPersonName(s string) string

清理人名

func CnBrackets

func CnBrackets(content string) (rsp string)

替换括号为中文括号

func CosineSimilarity

func CosineSimilarity(a, b string) float64

计算两个字符串的余弦近似度

func EnBrackets

func EnBrackets(content string) (rsp string)

替换括号为英文括号

func GetHans

func GetHans(str string) string

获取汉字

func HasHan

func HasHan(str string) bool

是否包含中文

func HiddenMiddle

func HiddenMiddle(content string, bothLen int) string

隐藏字符串中间的内容

func HmacSha1

func HmacSha1(key, message string) string

func Md5

func Md5(s string) string

func Random

func Random(len int) string

func RemoveNonPrintable

func RemoveNonPrintable(s string) string

移除字符串中不可见字符

func Reverse

func Reverse(s string) string

func Sha1

func Sha1(message string) string

func Trim

func Trim(content string) (str string)

处理非可见字符

func UTF82GBK

func UTF82GBK(src string) ([]byte, error)

UTF82GBK : transform UTF8 rune into GBK byte array

func VerifyEmailFormat

func VerifyEmailFormat(email string) bool

func VerifyMobileFormat

func VerifyMobileFormat(mobileNum string) bool

Types

type SortHans

type SortHans []string

中文按拼音排序

func (SortHans) Len

func (s SortHans) Len() int

func (SortHans) Less

func (s SortHans) Less(i, j int) bool

func (SortHans) Swap

func (s SortHans) Swap(i, j int)

Jump to

Keyboard shortcuts

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