bkit

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 5 Imported by: 0

README

bkit

自己常用的方法封装

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HiddenStr

func HiddenStr(origin string, opts ...hiddenStrOption) string

HiddenStr 字符串替换,用于隐藏部分内容 默认配置是隐藏手机中间4位, 如: 138****8000

func HiddenStrHead

func HiddenStrHead(origin string, length int, opts ...hiddenStrOption) string

HiddenStrHead 从头部开始替换 Example: ReplaceStrTail("13800138000", 4) Out: ****0138000

func HiddenStrLength

func HiddenStrLength(length uint) hiddenStrOption

HiddenStrLength 设置替换的长度, 默认是 4

func HiddenStrStart

func HiddenStrStart(start uint) hiddenStrOption

HiddenStrStart 设置替换的开始位置,默认是 3

func HiddenStrSymbol

func HiddenStrSymbol(symbol string) hiddenStrOption

HiddenStrSymbol 设置隐藏时的替换内容, 默认是 *

func HiddenStrTail

func HiddenStrTail(origin string, length int, opts ...hiddenStrOption) string

HiddenStrTail 尾部开始隐藏 Example: HiddenStrTail("13800138000", 4) Out: 1380013****

func RandomOptionLength

func RandomOptionLength(length uint) randomOption

RandomOptionLength 设置随机字符串长度

func RandomOptionLetter

func RandomOptionLetter() randomOption

RandomOptionLetter 设置随机字符串为大小写英文字母

func RandomOptionLower

func RandomOptionLower() randomOption

RandomOptionLower 设置随机数为纯小写字母

func RandomOptionNumber

func RandomOptionNumber() randomOption

RandomOptionNumber 设置随机字符串为大小写英文字母

func RandomOptionUpper

func RandomOptionUpper() randomOption

RandomOptionUpper 设置随机字符串为纯大写字母

Types

type RandomResult

type RandomResult []byte

随机字符串返回类型

func Random

func Random(opts ...randomOption) RandomResult

Random 生成随机字符串,默认为大小写英文+数字, 长度为6

func (RandomResult) Int

func (b RandomResult) Int() int

ToInt 转成 int 类型, 不保证一定成功,要保证 seed 必须是纯数字,否则此处转换失败就是 0

func (RandomResult) String

func (b RandomResult) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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