Documentation ¶
Index ¶
- Constants
- Variables
- func Add(s []string, a string) []string
- func AddInt(s []int, a int) []int
- func AddInt64(s []int64, a int64) []int64
- func CmdRunWithTimeout(cmd *exec.Cmd, timeout time.Duration) (error, bool)
- func ConvertBase64ToImage(content string, imagePath, prefixURI string) (string, error)
- func ConvertToLetter(iCol int) string
- func DecimalAdd(f1, f2 float64) decimal.Decimal
- func DecimalAddToFloat(f1, f2 float64, round int) float64
- func DecimalAddToString(f1, f2 float64, round int) string
- func DecimalDiv(f1, f2 float64) decimal.Decimal
- func DecimalDivToFloat(f1, f2 float64, round int) float64
- func DecimalDivToString(f1, f2 float64, round int) string
- func DecimalMul(f1, f2 float64) decimal.Decimal
- func DecimalMulToFloat(f1, f2 float64, round int) float64
- func DecimalMulToString(f1, f2 float64, round int) string
- func DecimalSub(f1, f2 float64) decimal.Decimal
- func DecimalSubToFloat(f1, f2 float64, round int) float64
- func DecimalSubToString(f1, f2 float64, round int) string
- func DelFile(files []os.FileInfo, count int, fileDir string)
- func EncryptPhone(phone string) string
- func Exec(bin string, args ...string) (string, error)
- func ExecWithTimeout(bin string, timeout time.Duration, args ...string) (string, error)
- func FileGetContent(file string) (string, error)
- func FileMTime(file string) (int64, error)
- func FilePutContent(file string, content string) (int, error)
- func FileSize(file string) (int64, error)
- func FormatPhone(mobile string) string
- func FormatPhoneNumber(phone string) string
- func GeoPositionToDistance(from, to GeoPosition) int
- func GetDateBetweenByDateTypeAndDateTime(dateType int, dateTime string, timeFormatParams ...string) (startTimeStr, endTimeStr string)
- func GetDateBetweenByDateTypeAndDateTimeAndTimeRange(dateType int, dateTime string, timeFormatParams ...string) (string, string, [][]string)
- func GetFloat32Str(f float32) string
- func GetFloat64Str(f float64) string
- func GetFloatStr(f float64) string
- func GetInt16Str(d int16) string
- func GetInt32Str(d int32) string
- func GetInt64Str(d int64) string
- func GetInt8Str(d int8) string
- func GetIntStr(d int) string
- func GetIpMask(start, end string) string
- func GetRandomNumber(n int) string
- func GetStrBool(strv string, def ...bool) (bool, error)
- func GetStrFloat(strv string, def ...float64) (float64, error)
- func GetStrFloat32(strv string, def ...float32) (float32, error)
- func GetStrFloat64(strv string, def ...float64) (float64, error)
- func GetStrInt(strv string, def ...int) (int, error)
- func GetStrInt16(strv string, def ...int16) (int16, error)
- func GetStrInt32(strv string, def ...int32) (int32, error)
- func GetStrInt64(strv string, def ...int64) (int64, error)
- func GetStrInt8(strv string, def ...int8) (int8, error)
- func GetStrUint(strv string, def ...uint) (uint, error)
- func GetStrUint16(strv string, def ...uint16) (uint16, error)
- func GetStrUint32(strv string, def ...uint32) (uint32, error)
- func GetStrUint64(strv string, def ...uint64) (uint64, error)
- func GetStrUint8(strv string, def ...uint8) (uint8, error)
- func GetTimeAgo(t int64) (s string)
- func GetUint16Str(d uint16) string
- func GetUint32Str(d uint32) string
- func GetUint64Str(d uint64) string
- func GetUint8Str(d uint8) string
- func GetUintStr(d uint) string
- func GetWeekdayCnName(value string) (string, error)
- func InSlice(s []string, a string) bool
- func Ip2long(ipstr string) (ip uint32)
- func IsExist(path string) bool
- func IsFile(file string) bool
- func IsImage(extName string) bool
- func IsPrivateIP(ip string) bool
- func Long2ip(ip uint32) string
- func Mkdir(src string) error
- func RandomCreateBytes(n int, alphabets ...byte) []byte
- func Remove(file string) error
- func RemoveAll(path string) error
- func Rename(file string, to string) error
- func Repeat(s string, count int, sep ...string) string
- func Substr(s string, start, length int) string
- func Union(s []string, a []string) []string
- func Uniq(s []string) (r []string)
- func WebTime(t time.Time) string
- type FileRepos
- type GeoPosition
- type IpNetmask
- type Mail
- type Repository
Constants ¶
const ( DateTypeYear = iota DateTypeMonth DateTypeWeekday DateTypeDay )
Variables ¶
var WeekdayString = []string{"周日", "周一", "周二", "周三", "周四", "周五", "周六"}
Functions ¶
func Add ¶ added in v1.3.0
https://github.com/nsqio/nsq/blob/master/internal/stringy/slice.go
func ConvertBase64ToImage ¶ added in v1.2.0
转换base64为图片链接
func DecimalAddToFloat ¶ added in v1.5.1
decimal add to float
func DecimalAddToString ¶ added in v1.5.1
decimal add to string
func DecimalDivToFloat ¶ added in v1.5.1
decimal div to float
func DecimalDivToString ¶ added in v1.5.1
decimal div to string
func DecimalMulToFloat ¶ added in v1.5.1
decimal mul to float
func DecimalMulToString ¶ added in v1.5.1
decimal mul to string
func DecimalSubToFloat ¶ added in v1.5.1
decimal sub to float
func DecimalSubToString ¶ added in v1.5.1
decimal sub to string
func EncryptPhone ¶ added in v1.5.1
func ExecWithTimeout ¶
func FilePutContent ¶
put string to file
func FormatPhone ¶ added in v1.5.1
func FormatPhoneNumber ¶ added in v1.5.1
U+202A: LEFT-TO-RIGHT EMBEDDING (LRE) U+202B: RIGHT-TO-LEFT EMBEDDING (RLE) U+202D: LEFT-TO-RIGHT OVERRIDE (LRO) U+202E: RIGHT-TO-LEFT OVERRIDE (RLO) U+202C: POP DIRECTIONAL FORMATTING (PDF) U+202C: POP DIRECTIONAL FORMATTING (PDF)
func GeoPositionToDistance ¶ added in v1.3.0
func GeoPositionToDistance(from, to GeoPosition) int
单位:米
func GetDateBetweenByDateTypeAndDateTime ¶ added in v1.5.1
func GetDateBetweenByDateTypeAndDateTime(dateType int, dateTime string, timeFormatParams ...string) (startTimeStr, endTimeStr string)
GetDateBetweenByDateTypeAndDateTime
func GetDateBetweenByDateTypeAndDateTimeAndTimeRange ¶ added in v1.5.1
func GetDateBetweenByDateTypeAndDateTimeAndTimeRange(dateType int, dateTime string, timeFormatParams ...string) (string, string, [][]string)
GetDateBetweenByDateTypeAndDateTimeAndTimeRange
func GetFloat32Str ¶ added in v1.5.1
func GetFloat64Str ¶ added in v1.4.0
func GetFloatStr ¶ added in v1.4.0
func GetInt16Str ¶ added in v1.2.0
func GetInt32Str ¶ added in v1.2.0
func GetInt64Str ¶
func GetInt8Str ¶ added in v1.2.0
func GetIpMask ¶
如要将一B类IP地址为168.195.0.0的网络划分成若干子网,要求每个子网内有主机数为700台, 则该子网掩码的计算方法如下(也是对应以上各基本步骤): 第1步,首先将子网中要求容纳的主机数“700”转换成二进制,得到1010111100。 第2步,计算出该二进制的位数为10位,即n = 10 第3步,将255.255.255.255从后向前的10位全部置“0”,得到的二进制数为“11111111.11111111.11111100.00000000”, 转换成十进制后即为255.255.252.0,这就是该要划分成主机数为700的B类IP地址 168.195.0.0的子网掩码。
func GetStrFloat32 ¶ added in v1.5.1
func GetUint16Str ¶ added in v1.2.0
func GetUint32Str ¶ added in v1.2.0
func GetUint64Str ¶
func GetUint8Str ¶ added in v1.2.0
func GetUintStr ¶
func GetWeekdayCnName ¶ added in v1.4.1
GetWeekdayCnName 获取周一到周日
func RandomCreateBytes ¶ added in v1.2.0
RandomCreateBytes generate random []byte by specify chars.
func RemoveAll ¶
RemoveAll删除path指定的文件,或目录及它包含的任何下级对象。它会尝试删除所有东西,除非遇到错误并返回。 如果path指定的对象不存在,RemoveAll会返回nil而不返回错误。
Types ¶
type FileRepos ¶
type FileRepos []Repository
type GeoPosition ¶ added in v1.3.0
type IpNetmask ¶
type Mail ¶ added in v1.2.0
type Mail struct {
// contains filtered or unexported fields
}
func (*Mail) SendEmailDaemon ¶ added in v1.2.0
func (m *Mail) SendEmailDaemon()