# Packages
No description provided by the author
# Functions
Base64Decode takes in a Base64 string and returns a byte array and an error.
Base64Encode takes in a byte array then returns an encoded base64 string.
ByteArrayToString returns a string.
CalculateAmountWithFee returns a calculated fee included amount on fee.
CalculateFee returns a simple fee on amount.
CalculateNetProfit returns net profit.
CalculatePercentageDifference returns the percentage of difference between multiple time periods.
CalculatePercentageGainOrLoss returns the percentage rise over a certain period.
CreateDir creates a directory based on the supplied parameter.
EncodeURLValues concatenates url values onto a url string and returns a string.
ExtractHost returns the hostname out of a string.
ExtractPort returns the port name out of a string.
FloatFromString format.
FloatFromStringDontRound 不需要小数点四舍五入,直接取位数
example FloatFromStringDontRound(545, -2) // output: 500 FloatFromStringDontRound(-500,-2) // output: -500 FloatFromStringDontRound(1.1001, 2) // output: 1.1 FloatFromStringDontRound(1.454, 1) // output: 1.4.
FormatDecimalFloat64 获取精度计算后的数量
example FormatDecimalFloat64(123.456, -2) // output: 123.46 FormatDecimalFloat64(-500,-2) // output: -500 FormatDecimalFloat64(1.1001, -2) // output: 1.1 FormatDecimalFloat64(1.454, -1) // output: 1.5.
FormatDecimalString 格式化后的字符串 @param {[type]} this [description] @return {[type]} [description] formatDecimal_String("0.000163786", -6) //"0.000164".
FormatMapStringToString 将 map[string]interface{} 格式化成字符串 commonutils.FormatMapStringToString("买进补仓", logFileds).
No description provided by the author
GetExecutablePath returns the executables launch path.
GetFuncLine 获取调用方法的行号.
GetFuncName 获取调用方法的名称.
GetHMAC returns a keyed-hash message authentication code using the desired hashtype.
GetMD5 returns a MD5 hash of a byte array.
GetOSPathSlash returns the slash used by the operating systems file system.
GetRandomSalt returns a random salt.
GetSHA256 returns a SHA256 hash of a byte array.
GetSHA512 returns a SHA512 hash of a byte array.
GetURIPath returns the path of a URL given a URI.
HexDecodeToBytes takes in a hexadecimal string and returns a byte array.
HexEncodeToString takes in a hexadecimal byte array and returns a string.
Int32FromString format.
Int32ToString format
example Int32ToString(123) // output: "123" Int32ToString(-10) // output: "-10".
Int64DataCompare data checks the substring array with an input and returns a bool.
Int64FromString format.
IntDataCompare data checks the substring array with an input and returns a bool.
IntFromString format.
IsEnabled takes in a boolean param and returns a string if it is enabled or disabled.
IsValidCryptoAddress validates your cryptocurrency address string using the regexp package // Validation issues occurring because "3" is contained in litecoin and Bitcoin addresses - non-fatal.
JoinStrings joins an array together with the required separator and returns it as a string.
JSONDecode decodes JSON data into a structure.
JSONEncode encodes structure data into JSON.
NewHTTPClientWithTimeout initialises a new HTTP client with the specified timeout duration.
OutputCSV dumps data into a file as comma-separated values.
PathExists 判断文件或文件夹是否存在的方法.
ReadFile reads a file and returns read data as byte array.
RecvWindow 格式化时间.
RemoveFile removes a file.
ReplaceString replaces a string with another 返回将s中前n个不重叠old子串都替换为new的新字符串,如果n<0会替换所有old子串。.
RoundFloat rounds your floating point number to the desired decimal place.
Sha1ToHex Sign signs provided payload and returns encoded string sum.
SplitStrings splits blocks of strings from string into a string array using a separator ie "," or "_".
StringContains checks a substring if it contains your input then returns a bool.
StringDataCompare data checks the substring array with an input and returns a bool.
StringDataCompareInsensitive data checks the substring array with an input and returns a bool irrespective of lower or upper case strings.
StringDataCompareUpper data checks the substring array with an input and returns a bool irrespective of lower or upper case strings.
StringDataContains checks the substring array with an input and returns a bool.
StringDataContainsInsensitive checks the substring array with an input and returns a bool irrespective of lower or upper case strings.
StringDataContainsUpper checks the substring array with an input and returns a bool irrespective of lower or upper case strings.
StringSliceDifference concatenates slices together based on its index and returns an individual string array.
StringToLower changes strings to lowercase.
StringToUpper changes strings to uppercase.
TimeDataCompare data checks the substring array with an input and returns a bool.
TimeFromUnixEscInt64 format i := int64(1530854162) fmt.Println(TimeFromUnixNescInt64(i)) //2018-07-06 13:16:02.
TimeFromUnixNEscInt64 format i := int64(1532246192000) t := commonutils.TimeFromUnixEscInt64(i) fmt.Println(t.Format("2006-01-02 15:04:05")) //2018-07-22 15:56:32.
TimeFromUnixTimestampFloat format.
TrimString trims unwanted prefixes or postfixes.
UnixNesc 格式化时间 i := int64(1532246192000) t := commonutils.TimeFromUnixNEscInt64(i) fmt.Println(t.Format("2006-01-02 15:04:05")) //2018-07-22 15:56:32 fmt.Println(commonutils.UnixNesc(t)) // 1532246192000.
UnixTimestampStrToTime returns a time.time and an error.
UnixTimestampToTime returns time.time.
WriteFile writes selected data to a file and returns an error.
YesOrNo returns a boolean variable to check if input is "y" or "yes".
# Constants
Const declarations for common.go operations.
Const declarations for common.go operations.
Const declarations for common.go operations.
Const declarations for common.go operations.
Const declarations for common.go operations.
Const declarations for common.go operations.
Const declarations for common.go operations.
Const declarations for common.go operations.