# Packages
No description provided by the author
No description provided by the author
No description provided by the author
Package uuid provides implementation of Universally Unique Identifier (UUID).
# Functions
Between ...
Between ...
CamelCase 将一个字符串转为大驼峰命名.
CamelCaseInitialism 将一个字符串转为大驼峰命名,强制首字母缩写命名规范.
Command execute system cmd.
ComparePinyinByRune 计算两个汉字的读音是否相同.
Concat 连接字符串.
CopyFile copy source file to destination file.
Empty ...
Eq ...
FilterRepeatSliceInt 过滤重复项(int).
FriendlyTime 将时间格式化为: 几秒前,几分钟前,几小时前,日期 2006-01-02.
GBKToUTF8 GBK转换成UTF-8编码.
GenerateTextAvatar 生成文字头像 参数:保存文件名,文字,字体,背景色,尺寸(等比宽高) 背景色:默认随机 尺寸:等比的宽高,默认 512 * 512.
GenerateTextImage 生成文字的图像 text 是要生成的文字 fontFamily 字体文件 size 是生成图片的尺寸,等比的宽高.
GetDir get pwd.
GetExt get file extenstion, not contains dot.
GetPinyinByRune 获取一个汉字的拼音,开启多音字模式,返回可能的多个拼音.
GetPinyinByString 获取一个字符串的拼音,开启多音字模式,每个汉字返回一个拼音切片.
Glob 查找指定目录下的文件列表.
Gt ...
HexColor2RGBA parses a "html" hex color-string, either in the 3 "#F0C" or 6 "#FF1034" digits form.
HTTPBuildQuery 模仿php的http_build_query构建字符串 JAVA String resultMD5 = MD5.md5(result.toString().replace("*", "%2A").replace("%7E", "~").replace("+", "%20"));.
HTTPDownload HTTP下载文件.
HTTPGet 带超时设置的请求一个url,单位: 秒.
HTTPPost 使用POST Form方式请求数据,超时 单位:秒.
HTTPPostFile 使用POST上传文件,超时 单位:秒 在参数中,如果要上传文件,设 params[file]=@/data/upload/1.zip 即可,注意 @ 符号.
HTTPPostJSON 使用POST JSON方式请求数据,超时 单位:秒.
HTTPRangeDownload HTTP断点续传下载文件,提供下载进度,通过 range process得到进度条.
HTTPSortQuery http字段排序.
ImageCut 图像裁剪.
ImageCutWithFormat 图像裁剪 无后缀输出jpg.
ImageFormatDiscernment 识别格式.
ImageSize 返回一个图片的宽和高.
ImageSizeWithFormat 返回一个图片的宽和高.
InSlice 判断元素s是否在slice si中出现过,返回 bool.
IntToString 将数字转换为字符串.
IP2Long ip to int.
IsExist check path is exists, exist return true, not exist return false.
IsNumeric 判断是否是纯数字,空字符串不是数字,0才是.
IsWritable check path is writeable, can return true, can not return false.
LocalIPAddrs get local public address.
Long2IP int to ip.
Lt ...
MapFillStruct 用map填充结构体,遇到未知字段或数值转换错误返回具体错误.
MapFillStructMust 用map填充结构体,忽略所有不能填充的类型.
MapMerge 合并字典,如果m1和m2中有同名KEY,使用m2中的值覆盖m1中的值.
MaskEmail 使用指定字符遮罩邮箱.
MaskMobile 使用指定字符遮罩手机号.
MaskString 使用指定字符遮罩字符串.
MD5 checksum for str.
MD5File checksum for file path.
MixedToSliceInt 将混合类型转为 数字slice.
MixedToSliceString 将混合类型转为 字符串slice.
MkdirAll check the path isexist or mkdir, and check writable.
MustFloat64 转换值为 float64 类型.
MustInt 转换值为 int 类型.
MustInt64 转换值为 int64 类型.
Neq ...
New returns a new random string of the standard length, consisting of standard characters.
NewImage 生成新的图片.
NewLen returns a new random string of the provided length, consisting of standard characters.
NewLenChars returns a new random string of the provided length, consisting of the provided byte slice of allowed characters (maximum 256).
Nl2br 将换行转换成HTML中的BR.
NormalizeURL 规范化链接.
PdfPageCount 读取PDF文件的页码数.
PurgeText 纯净的文本,不带html标签,没有换行,没有制表符.
RandFileName 随机生成一个文件名.
RandInt 随机数.
RandStr 随机字符串.
ReadDir read path return files by os.FileInfo.
ReadFile read file content.
ReadFileBlock read file block content.
RemoveFile 删除文件.
RGBA2HexColor returns the hex "html" representation of the color, as in #FF0080.
Scale 缩放图像 参数:src 原始图像路径,dst 目标图像路径,如果为空或相同则覆盖原始文件,w,h 为缩放后的宽高 equalRate 参数决定是否等比缩放,开启等比缩放时,将大小控制在指定的区域内,图像尺寸小于等于给定尺寸 cut 参数觉决定是否使用裁剪方案,当使用裁剪时,使用较小的缩放比,满足最小边在指定区域内,同时将多余(在区域外)的部分减掉 当使用 cut 启用裁剪时,忽略 equalRate的设置,使用等比缩放并裁剪 缩放函数有四个 draw.NearestNeighbor, draw.ApproxBiLinear, draw.BiLinear, draw.CatmullRom, 具体区别参见:https://godoc.org/github.com/golang/image/draw#pkg-variables// 使用方法,非常简单: err = Scale("2.jpg", "a1.png", 100, 100, false, false)
err = Scale("2.jpg", "a2.png", 100, 100, true, false)
err = Scale("2.jpg", "a3.png", 100, 100, false, true)
err = Scale("2.jpg", "a4.png", 100, 100, true, true)
*/.
SecondToTime 将秒格式化为 几小时:几分钟:几秒.
SHA1 sha1 Encrypted data.
SliceIntDiff 获取在数字切片 a 中但不在数字切片 b 中的差集.
SliceIntEqual 判断两个数字切片中的内容是否相同,忽略元素的排序 [1,2,3] == [3,2,1].
SliceIntRand 将切片顺序打乱随机返回.
SliceIntToString 将数字切片转换为字符串切片 [11,22,33] 转换为 ["11","22","33"].
SliceStringDiff 获取在字符串切片 a 中但不在字符串切片 b 中的差集.
SortByID 对结构体Slice的field字段参照sortIDs顺序排序.
SortParams 获取一个排序的string参数列表.
SplitStringToIntSlice 将字符串分割成数字数组,并去除空行.
SplitStringToSlice 将字符串分割成数组,并去除空行.
StringToInt 将字符串转为int.
StringToInt64 将字符串转为int64.
StringToPinyin 获取一个字符串的拼音,关闭多音字模式.
StripTags 过滤HTML标签,保留指定的tag.
StrNatCut 字符串截取,中文算一个 英文也算一个.
StrNatCutGBK 字符串截取,中文算两个 英文算一个.
StrNatCutNature 字符串截取,无论中英文一个字符算文算一个,可以指定是否要截取最后一个句号.
StrPad 使用另一个字符串填充字符串为指定长度.
StructToMap 将结构体的字段填充到map中.
StructToStruct 结构体COPY.
ToString 将任意一个类型转换为字符串.
UserAgentInfo 根据UA获取系统和浏览器.
UTF8ToGBK 转换成GBK编码.
No description provided by the author
WriteFile read content to the file.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
数字、大小写字母.
小写字母.
纯数字.
大写字母.
QUERY_RFC1738 则编码将会以 » RFC 1738 标准和 application/x-www-form-urlencoded 媒体类型进行编码,空格会被编码成加号(+)。.
QUERY_RFC3986 将根据 » RFC 3986 编码,空格会被百分号编码(%20)。.
Standard length of uniuri string to achive ~95 bits of entropy.
No description provided by the author
No description provided by the author
No description provided by the author
Length of uniurl string to achive ~119 bits of entropy, closest to what can be losslessly converted to UUIDv4 (122 bits).
# Variables
No description provided by the author
ErrNotSupportFromat 不支持的格式.
Standard characters allowed in uniuri string.