gostring

package
v0.0.0-...-01a1fb0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Helper = &GoString{}

Functions

func NewSonyflake

func NewSonyflake() *sonyflake.Sonyflake

fix no private ip address error

Types

type GoString

type GoString struct{}

func (*GoString) AntiSpamBot

func (this *GoString) AntiSpamBot(email string) string

email 反爬虫

func (*GoString) AutoUTF8

func (this *GoString) AutoUTF8(html string) (string, error)

自动转成 utf-8

func (*GoString) DeepProcessingRegex

func (this *GoString) DeepProcessingRegex(regex string) string

{数字} => ^[0-9]+$ [数字] => (^[0-9]+$) {内容} => .*? [内容] => (.*?)

func (*GoString) FirstLetter

func (this *GoString) FirstLetter(text, sep string) string

获取汉字的首字母

func (*GoString) GBKToUTF8

func (this *GoString) GBKToUTF8(text []byte) ([]byte, error)

gbk 转 utf-8

func (this *GoString) GetLinks(data string) ([]string, error)

提取链接

func (*GoString) GetRandomString

func (this *GoString) GetRandomString(n int) string

随机字符串

func (*GoString) HtmlAttributes

func (this *GoString) HtmlAttributes(data, ele, attr string) ([]string, error)

func (*GoString) HtmlBaseUrl

func (this *GoString) HtmlBaseUrl(html string) string

获取HTML中base标签指定的链接地址

func (*GoString) HtmlCharset

func (this *GoString) HtmlCharset(html string) string

获取 HTML 编码

func (*GoString) HumanBytes

func (this *GoString) HumanBytes(size int64) string

单位转换

func (*GoString) InSlice

func (this *GoString) InSlice(value string, values []string) bool

不区分大小写

func (*GoString) IsExactMatch

func (this *GoString) IsExactMatch(regex, data string) bool

是否精确匹配

func (*GoString) IsMatch

func (this *GoString) IsMatch(regex, data string) bool

是否存在匹配

func (*GoString) LeftSlash

func (this *GoString) LeftSlash(str string) string

以斜杠开头,结尾没有斜杠

func (*GoString) MD5

func (this *GoString) MD5(str string) string

md5编码

func (*GoString) Pinyin

func (this *GoString) Pinyin(text, sep string) string

获取汉字的拼音

func (*GoString) Random

func (this *GoString) Random(n int) string

随机字符串

func (*GoString) RegexpAllMatch

func (this *GoString) RegexpAllMatch(regex, data string) (matches []string)

所有匹配

func (*GoString) RegexpOneMatch

func (this *GoString) RegexpOneMatch(regex, data string) string

一个匹配

func (*GoString) RemoveDuplicate

func (this *GoString) RemoveDuplicate(slis *[]string)

去重

func (*GoString) RemoveSlice

func (this *GoString) RemoveSlice(values []string, value string) []string

func (*GoString) RightSlash

func (this *GoString) RightSlash(str string) string

以斜杠结尾, 开头没有斜杠

func (*GoString) ShortUUID

func (this *GoString) ShortUUID() string

func (*GoString) SliceContains

func (this *GoString) SliceContains(ss []string, s string) bool

区分大小写

func (*GoString) SplitUpper

func (this *GoString) SplitUpper(data string) []string

根据大写字母分隔字符串

func (*GoString) StripHTML

func (this *GoString) StripHTML(html string) string

func (*GoString) StripHTMLTags

func (this *GoString) StripHTMLTags(html string) string

去除 html标签

func (*GoString) Sub

func (this *GoString) Sub(html, begin, end string) string

func (*GoString) ToBool

func (this *GoString) ToBool(value string) (bool, error)

func (*GoString) ToInt

func (this *GoString) ToInt(value string) (int, error)

func (*GoString) ToInt64

func (this *GoString) ToInt64(value string) (int64, error)

func (*GoString) ToUint

func (this *GoString) ToUint(value string) (uint, error)

func (*GoString) ToUint64

func (this *GoString) ToUint64(value string) (uint64, error)

func (*GoString) TrimLeftSlash

func (this *GoString) TrimLeftSlash(str string) string

去除开头斜杠 /

func (*GoString) TrimRightSlash

func (this *GoString) TrimRightSlash(str string) string

去除结尾斜杠 /

func (*GoString) TrimSlash

func (this *GoString) TrimSlash(str string) string

去除头尾斜杠 /

func (*GoString) UTF8ToGBK

func (this *GoString) UTF8ToGBK(text []byte) ([]byte, error)

utf-8 转 gbk

func (*GoString) UUID

func (this *GoString) UUID() string

Jump to

Keyboard shortcuts

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