package
0.0.0-20200613035304-c4769b55a45c
Repository: https://github.com/safeie/spider.git
Documentation: pkg.go.dev
# Functions
AesDecrypt aes解密.
AesEncrypt aes加密.
CamelCase 将一个字符串转为大驼峰命名.
CamelCaseInitialism 将一个字符串转为大驼峰命名,强制首字母缩写命名规范.
Command execute system cmd.
Concat 连接字符串.
CopyFile copy source file to destination file.
DownloadFile 下载文件.
Empty ...
Eq ...
Errorf 报错.
FormatSize 格式化size单位 输出友好格式(B,KB,MB,GB,TB).
FriendlyTime 将时间格式化为: 几秒前,几分钟前,几小时前,日期 2006-01-02.
GetDir get pwd.
GetExt get file extenstion, not contains dot.
GetPathSize 获取一个文件或目录的大小.
Glob 查找指定目录下的文件列表.
Gt ...
HTTPBuildQuery 模仿php的http_build_query构建字符串 JAVA String resultMD5 = MD5.md5(result.toString().replace("*", "%2A").replace("%7E", "~").replace("+", "%20"));.
No description provided by the author
InSlice 判断元素s是否在slice si中出现过,返回 bool.
Int2String format int to string.
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.
KeepTags 过滤HTML标签,只保留 指定的tag.
LocalIPAddrs get local public address.
Long2IP int to ip.
Lt ...
MapFillStruct 用map填充结构体,遇到未知字段或数值转换错误返回具体错误.
MapFillStructMust 用map填充结构体,忽略所有不能填充的类型.
MathRound 四舍五入一个浮点数,返回整数.
MD5 get hash of string.
MD5Bytes get hash of bytes.
MD5File get hash of file content.
MixedToSliceInt 将混合类型转为 数字slice.
MixedToSliceString 将混合类型转为 字符串slice.
MkdirAll check the path isexist or mkdir, and check writable.
Neq ...
NewError 创建新的错误.
Nl2br 将换行转换成HTML中的BR.
PKCS5Padding aes加密补码.
PKCS5UnPadding aes解密去码.
RandFileName 随机生成一个文件名.
RandInt 随机数字.
随机字符串.
ReadDir read path return files by os.FileInfo.
ReadFile read file content.
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 将秒格式化为 几小时:几分钟:几秒.
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顺序排序.
String2Int format string to int.
StringToInt 将字符串转为int.
StringToInt64 将字符串转为int64.
StripTags 过滤HTML标签,只去除 指定的tag.
StrNatCut 字符串截取,中文算一个 英文算两个.
StrPad 使用另一个字符串填充字符串为指定长度.
StructToMap 将结构体的字段填充到map中.
StructToStruct 结构体COPY.
ToString 将任意一个类型转换为字符串.
No description provided by the author
VersionDiff 如果v1大于等于v2返回true, 否则返回 false.
WriteFile write file content.
# Constants
数字、大小写字母.
小写字母.
纯数字.
大写字母.
QUERY_RFC1738 则编码将会以 » RFC 1738 标准和 application/x-www-form-urlencoded 媒体类型进行编码,空格会被编码成加号(+)。.
QUERY_RFC3986 将根据 » RFC 3986 编码,空格会被百分号编码(%20)。.
No description provided by the author
No description provided by the author
No description provided by the author