xgostring

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: BSD-3-Clause-Clear Imports: 6 Imported by: 0

Documentation

Overview

字符串处理方法

Index

Constants

View Source
const (
	PAD_LEFT  = 1
	PAD_RIGHT = 2
)

Variables

This section is empty.

Functions

func Charset

func Charset(src string, srcCode string, target string) []byte

字符串编码转换

str		string	要转换的字符串
strCode	string	输入字符串编码
target	string	输出字符串编码格式

func HtmlTrim

func HtmlTrim(src string) string

去除html标签和空白符

src	待去除的网页代码

func Pad

func Pad(input string, padLength int, padString string, padType int) string

字符串填充到指定长度

input	string	原字符串
padLength	int	规定补齐后的字符串位数
padString	string	自定义填充字符串
padType	string	填充类型:PAD_LEFT(向左填充,自动补齐位数), 默认右侧

func Phone

func Phone(t string) string

手机号脱敏

t	待脱敏的手机号

func Random

func Random(l int, arg ...string) string

获取随机数

l	int	获取随机数长度
arg	string	可选参数,随机数的发生范围【只有第一个可选参数生效】

func UUID

func UUID() string

生成UUID

基于 `satori/go.uuid` 库,使用

Types

This section is empty.

Jump to

Keyboard shortcuts

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