xstr

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

字符串帮助函数

  • RandStringBytes 生成指定长度的字符串
  • RandStringBytesMaskImprSrcUnsafe 生成指定长度的字符串,高效率版

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaskPhoneNumber

func MaskPhoneNumber(number string) string

MaskPhoneNumber - 手机号掩码为 132****1111 的格式

func MaskRealname

func MaskRealname(name string, mask bool) string

MaskRealname - 汉字名称只保留姓

func RandStringBytesMaskImprSrcUnsafe

func RandStringBytesMaskImprSrcUnsafe(n int) string

RandStringBytesMaskImprSrcUnsafe - 比 RandStringBytes 快 6.3 倍,并且只使用了六分之一的内存和一半的内存分配 https://www.flysnow.org/2019/09/30/how-to-generate-a-random-string-of-a-fixed-length-in-go.html

func UUIDNumber

func UUIDNumber() (str string)

通过 UUID v4 的方案生成微信商户订单号 商户订单号,需保持唯一性,只能是字母或者数字,不能包含有其他字符,长度为32位。

Types

This section is empty.

Jump to

Keyboard shortcuts

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