Documentation ¶
Index ¶
- Variables
- func AESDecrypt(src, key []byte) ([]byte, error)
- func AESEncrypt(src, key []byte) ([]byte, error)
- func AddDebug(strA string)
- func AddDebugF(formatA string, argsA ...interface{})
- func AddLastSubString(strA string, subStrA string) string
- func AnalyzeCommandLineParamter(cmdLineA string) []string
- func AnalyzeURLParams(strA string) map[string]string
- func AppendDualLineList(listA [][]string, fileNameA string) string
- func AppendSimpleMapFromFile(mapA map[string]string, fileNameA string) string
- func AppendStringToFile(strA string, fileA string) string
- func ByteToHex(byteA byte) string
- func CalCosineSimilarityBetweenFloatsBig(f1, f2 []float64) float64
- func ClearDebug()
- func ContainsInStringList(strA string, strListA []string) bool
- func ConvertToGB18030(srcA string) string
- func ConvertToGB18030Bytes(srcA string) []byte
- func ConvertToUTF8(srcA []byte, srcEncA string) string
- func DecodeStringSimple(s string) string
- func DeleteItemInInt64Array(aryA []int64, idxA int64) []int64
- func DeleteItemInIntArray(aryA []int, idxA int) []int
- func DeleteItemInStringArray(aryA []string, idxA int) []string
- func DownloadPage(urlA string, originalEncodingA string, postDataA url.Values, ...) string
- func DownloadPageUTF8(urlA string, postDataA url.Values, customHeaders string, ...) string
- func EncodeStringSimple(strA string) string
- func EndsWith(strA string, subStrA string) bool
- func EnsureMakeDirs(pathA string) string
- func EnsureValidFileNameX(fileNameA string) string
- func FindFirstDiffIndex(strA string, str2A string) int
- func FindSamePrefix(strA, str2A string) string
- func Float32ArrayToFloat64Array(aryA []float32) []float64
- func Float64ToStr(floatA float64) string
- func GenerateErrorString(errStrA string) string
- func GenerateErrorStringF(formatA string, argsA ...interface{}) string
- func GenerateFileListRecursively(dirA string, patternA string) []string
- func GenerateJSONPResponse(statusA string, valueA string, reqA *http.Request) string
- func GenerateJSONPResponseWithObject(statusA string, valueA string, objectA string, reqA *http.Request) string
- func GetApplicationPath() string
- func GetDebug() string
- func GetDirOfFilePath(pathA string) string
- func GetErrorString(errStrA string) string
- func GetFileExt(filePathA string) string
- func GetFilePathSeperator() string
- func GetFormValueWithDefaultValue(reqA *http.Request, keyA string, defaultA string) string
- func GetGlobalEnvList() []string
- func GetGlobalEnvString() string
- func GetInputBufferedScan() string
- func GetLastComponentOfFilePath(pathA string) string
- func GetNowDateString() string
- func GetNowTimeOnlyStringBeijing() string
- func GetNowTimeString() string
- func GetNowTimeStringFormal() string
- func GetNowTimeStringHourMinute() string
- func GetOSName() string
- func GetParameterByIndexWithDefaultValue(argsA []string, idxA int, defaultA string) string
- func GetRandomInt64InRange(minA int64, maxA int64) int64
- func GetRandomInt64LessThan(maxA int64) int64
- func GetRandomIntInRange(minA int, maxA int) int
- func GetRandomIntLessThan(maxA int) int
- func GetRandomSubDualList(listA [][]string, countA int) [][]string
- func GetRandomizeInt64ArrayCopy(aryA []int64) []int64
- func GetRandomizeIntArrayCopy(aryA []int) []int
- func GetRandomizeStringArrayCopy(aryA []string) []string
- func GetRuntimeStack() string
- func GetSuccessValue(strA string) string
- func GetSwitchWithDefaultInt64Value(argsA []string, switchStrA string, defaultA int64) int64
- func GetSwitchWithDefaultIntValue(argsA []string, switchStrA string, defaultA int) int
- func GetSwitchWithDefaultValue(argsA []string, switchStrA string, defaultA string) string
- func HasGlobalEnv(vA string) bool
- func IfFileExists(fileNameA string) bool
- func IfSwitchExists(argsA []string, switchStrA string) bool
- func InStrings(strA string, argsA ...string) bool
- func IndexInStringList(strA string, strListA []string) int
- func IndexInStringListFromEnd(strA string, strListA []string) int
- func Int64ArrayToFloat64Array(aryA []int64) []float64
- func Int64ToStr(intA int64) string
- func IntToStr(intA int) string
- func IsDirectory(dirNameA string) bool
- func IsEmptyTrim(strA string) bool
- func IsErrorString(errStrA string) bool
- func IsFile(fileNameA string) bool
- func JSONToMapStringString(objStrA string) map[string]string
- func JoinDualList(listA [][]string, sepItemA, sepInItemA string, withLineNumberA bool) string
- func JoinLines(strListA []string) string
- func JoinLinesBySeparator(strListA []string, sepA string) string
- func Len64(aryA []string) int64
- func LoadBytes(fileNameA string, numA int) []byte
- func LoadDualLineList(fileNameA string) ([][]string, string)
- func LoadDualLineListFromString(strA string) [][]string
- func LoadSimpleMapFromDir(dirA string) map[string]string
- func LoadSimpleMapFromFile(fileNameA string) map[string]string
- func LoadStringFromFile(fileNameA string) string
- func LoadStringList(fileNameA string) ([]string, string)
- func LogWithTime(formatA string, argsA ...interface{})
- func MD5Encrypt(strA string) string
- func NowToFileName() string
- func ObjectToJSON(objA interface{}) string
- func ObjectToJSONIndent(objA interface{}) string
- func Pkcs7Padding(ciphertext []byte, blockSize int) []byte
- func Pl(formatA string, argsA ...interface{})
- func PlAndExit(formatA string, argsA ...interface{})
- func PlErr(errA error)
- func PlErrAndExit(errA error)
- func PlErrSimple(formatA string, argsA ...interface{})
- func PlErrSimpleAndExit(formatA string, argsA ...interface{})
- func PlSimpleErrorString(strA string)
- func PlTXErr(strA string)
- func Plv(argsA ...interface{})
- func PlvWithError(vA interface{}, errStrA string)
- func PostRequest(urlA, reqBodyA string, timeoutSecsA time.Duration) (string, error)
- func Pr(argsA ...interface{})
- func Prf(formatA string, argsA ...interface{})
- func Printf(format string, a ...interface{})
- func Printfln(format string, a ...interface{})
- func Randomize()
- func RegContains(strA, patternA string) bool
- func RegFindAll(strA, patternA string, groupA int) []string
- func RegFindFirst(strA, patternA string, groupA int) string
- func RegMatch(strA, patternA string) bool
- func RegReplace(strA, patternA, replaceA string) string
- func RemoveDuplicateInDualLineList(listA [][]string) [][]string
- func RemoveFileExt(filePathA string) string
- func RemoveGlobalEnv(vA string)
- func RemoveLastSubString(strA string, subStrA string) string
- func Replace(strA, findA, replaceA string) string
- func ReplaceLineEnds(strA string, replacementA string) string
- func RestoreLineEnds(strA string, replacementA string) string
- func SaveDualLineList(listA [][]string, fileNameA string) string
- func SaveSimpleMapToFile(mapA map[string]string, fileA string) string
- func SaveStringList(strListA []string, fileA string) string
- func SaveStringListWin(strListA []string, fileA string) string
- func SaveStringToFile(strA string, fileA string) string
- func SetGlobalEnv(vA string)
- func SetLogFile(fileNameA string)
- func ShuffleStringArray(aryA []string, timesA int)
- func SleepMilliSeconds(msA int)
- func SleepSeconds(secA int)
- func Split(strA string, sepA string) []string
- func SplitLines(strA string) []string
- func SplitLinesRemoveEmpty(strA string) []string
- func SplitN(strA string, sepA string, countA int) []string
- func Spr(formatA string, argsA ...interface{}) string
- func StartsWith(strA string, subStrA string) bool
- func StartsWithDigit(strA string) bool
- func StartsWithIgnoreCase(strA string, subStrA string) bool
- func StartsWithUpper(wordA string) bool
- func StrToBool(strA string) bool
- func StrToFloat64WithDefaultValue(strA string, defaultA float64) float64
- func StrToInt64WithDefaultValue(strA string, defaultA int64) int64
- func StrToIntPositive(strA string) int
- func StrToIntWithDefaultValue(strA string, defaultA int) int
- func StrToTimeCompact(strA string, defaultA time.Time) time.Time
- func StrToTimeCompactNoError(strA string) time.Time
- func StringReplace(strA string, argsA ...string) string
- func Trim(strA string) string
- func TrimCharSet(strA string, charSetA string) string
- type ExitCallback
- type RandomX
- type SimpleEvent
- type TXCollection
- func (p *TXCollection) AddOrSet(strA string)
- func (p *TXCollection) AddOrSetExcludeEmpty(strA string)
- func (p *TXCollection) Contains(strA string) bool
- func (p *TXCollection) GetList() []string
- func (p *TXCollection) GetListString(ifUpA bool, sepA string) string
- func (p *TXCollection) GetSortedList(ifUpA bool) []string
- func (p *TXCollection) InitX(sizeA int)
- func (p *TXCollection) Length() int
- func (p *TXCollection) Remove(strA string) bool
- func (p *TXCollection) Size() int
- type TXResult
- type TXString
- func CreateString(strA string, errA string) *TXString
- func CreateStringEmpty() *TXString
- func CreateStringError(errA string) *TXString
- func CreateStringErrorF(formatA string, argsA ...interface{}) *TXString
- func CreateStringErrorFromTXError(errA string) *TXString
- func CreateStringSimple(strA string) *TXString
- func CreateStringSuccess() *TXString
- func CreateStringWithObject(strA string, objA interface{}) *TXString
- func GenerateErrorStringFTX(formatA string, argsA ...interface{}) *TXString
- func GenerateErrorStringTX(errStrA string) *TXString
- func LoadStringTX(fileNameA string) *TXString
- func RegFindFirstTX(strA, patternA string, groupA int) *TXString
- func (p *TXString) Contains(patternA string) bool
- func (p *TXString) ContainsInHtmlAttributeString(substrA string) bool
- func (p *TXString) CutToLen(lenA int) string
- func (p *TXString) EQ(strA string) bool
- func (p *TXString) EndsWith(strA string) bool
- func (p *TXString) Equals(strA string) bool
- func (p *TXString) EqualsIgnoreCase(strA string) bool
- func (p *TXString) Error() string
- func (p *TXString) ErrorString() string
- func (p *TXString) ErrorStringF(formatA string) string
- func (p *TXString) InitWithString(strA string) *TXString
- func (p *TXString) IsEmpty() bool
- func (p *TXString) IsEmptyTrim() bool
- func (p *TXString) IsError() bool
- func (p *TXString) JSONString() string
- func (p *TXString) Length() int
- func (p *TXString) List() []string
- func (p *TXString) PlErr(prefixA string) *TXString
- func (p *TXString) PlSuccessOrErr(workA string) *TXString
- func (p *TXString) Print()
- func (p *TXString) PrintResultWithTimeLast()
- func (p *TXString) PrintWithPrefixTime(prefixA string)
- func (p *TXString) PrintWithPrefixTimeLast(prefixA string)
- func (p *TXString) PrintWithTimeLast()
- func (p *TXString) RegFindAll(patternA string, groupA int) []string
- func (p *TXString) RegFindFirst(patternA string, groupA int) string
- func (p *TXString) RegReplace(patternA string, replacementA string) *TXString
- func (p *TXString) Replace(patternA string, replacementA string) *TXString
- func (p *TXString) Save(fileA string) *TXString
- func (p *TXString) Set(strA string) *TXString
- func (p *TXString) SplitLines() []string
- func (p *TXString) StartsWith(strA string) bool
- func (p *TXString) String() string
- func (p *TXString) StringEmptyIfError() string
- func (p *TXString) ToStringList() []string
- func (p *TXString) ToStringListRemoveEmpty() []string
- func (p *TXString) Trim() *TXString
- type TXStringArray
- type TXStringSlice
Constants ¶
This section is empty.
Variables ¶
var DebugModeG bool = false
var TXTimeFormatCompact = "20060102150405"
Functions ¶
func AESDecrypt ¶
func AESEncrypt ¶
func AddLastSubString ¶
func AnalyzeCommandLineParamter ¶
AnalyzeCommandLineParamter 分解命令行参数,注意如果要带双引号,需要从开始到结束都括上,例如save "-fileName=abc.txt",而不是save -fileName="abc.txt"
func AnalyzeURLParams ¶
func AppendDualLineList ¶
func AppendSimpleMapFromFile ¶
func AppendStringToFile ¶
func ClearDebug ¶
func ClearDebug()
func ContainsInStringList ¶
func ConvertToGB18030 ¶
ConvertToGB18030 转换UTF-8字符串为GB18030编码
func ConvertToGB18030Bytes ¶
ConvertToGB18030Bytes 转换UTF-8字符串为GB18030编码的字节切片
func ConvertToUTF8 ¶
ConvertToUTF8 转换GB18030编码等字符串为UTF-8字符串
func DecodeStringSimple ¶
func DeleteItemInInt64Array ¶
func DeleteItemInIntArray ¶
DeleteItemInIntArray 删除字符串切片中的某一项
func DeleteItemInStringArray ¶
DeleteItemInStringArray 删除字符串切片中的某一项
func DownloadPage ¶
func DownloadPage(urlA string, originalEncodingA string, postDataA url.Values, customHeaders string, timeoutSecsA time.Duration) string
DownloadPage download page with any encoding and convert to UTF-8
func DownloadPageUTF8 ¶
func EncodeStringSimple ¶
func EnsureMakeDirs ¶
func EnsureValidFileNameX ¶
EnsureValidFileNameX 确保文件名合理并且长度合适
func FindFirstDiffIndex ¶
func FindSamePrefix ¶
func Float64ToStr ¶
func GenerateErrorString ¶
GenerateErrorString 生成一个出错字符串
func GenerateErrorStringF ¶
GenerateErrorStringF 生成一个出错字符串,但可以加上格式,类似Printf
func GenerateJSONPResponse ¶
func GetApplicationPath ¶
func GetApplicationPath() string
func GetDirOfFilePath ¶
func GetFileExt ¶
func GetFilePathSeperator ¶
func GetFilePathSeperator() string
func GetGlobalEnvList ¶
func GetGlobalEnvList() []string
func GetGlobalEnvString ¶
func GetGlobalEnvString() string
func GetNowTimeOnlyStringBeijing ¶
func GetNowTimeOnlyStringBeijing() string
func GetNowTimeStringFormal ¶
func GetNowTimeStringFormal() string
func GetNowTimeStringHourMinute ¶
func GetNowTimeStringHourMinute() string
func GetParameterByIndexWithDefaultValue ¶
GetParameterByIndexWithDefaultValue 按顺序序号获取命令行参数,其中0代表第一个参数,也就是软件名称或者命令名称,1开始才是第一个参数,注意参数不包括开关,即类似-verbose=true这样的
func GetRandomInt64InRange ¶
func GetRandomInt64LessThan ¶
func GetRandomIntInRange ¶
GetRandomIntInRange 获取[minA-maxA]之间的随机数
func GetRandomIntLessThan ¶
GetRandomIntLessThan 获取[0-maxA)之间的随机数
func GetRandomSubDualList ¶
func GetRandomizeIntArrayCopy ¶
GetRandomizeIntArrayCopy 获得一个随机化顺序后的int数组
func GetRandomizeStringArrayCopy ¶
GetRandomizeStringArrayCopy 获得一个随机化后的字符串数组
func GetRuntimeStack ¶
func GetRuntimeStack() string
func GetSuccessValue ¶
func GetSwitchWithDefaultIntValue ¶
GetSwitchWithDefaultIntValue 与GetSwitchWithDefaultValue类似,返回一个整数
func GetSwitchWithDefaultValue ¶
GetSwitchWithDefaultValue 获取命令行参数中的开关,用法:tmps := tk.GetSwitchWithDefaultValue(args, "-verbose=", "false")
func HasGlobalEnv ¶
func IfSwitchExists ¶
IfSwitchExists 判断命令行参数中是否存在开关,用法:flag := IfSwitchExists(args, "-restart")
func IndexInStringList ¶
func Int64ToStr ¶
func IsEmptyTrim ¶
func JSONToMapStringString ¶
func JoinDualList ¶
func JoinLinesBySeparator ¶
func LoadDualLineList ¶
func LoadSimpleMapFromDir ¶
func LoadSimpleMapFromFile ¶
func LoadStringFromFile ¶
LoadStringFromFile 从文件中读取整个内容到字符串中
func LoadStringList ¶
func LogWithTime ¶
func LogWithTime(formatA string, argsA ...interface{})
func MD5Encrypt ¶
func NowToFileName ¶
func NowToFileName() string
func ObjectToJSONIndent ¶
func ObjectToJSONIndent(objA interface{}) string
func Pkcs7Padding ¶
func PlErrAndExit ¶
func PlErrAndExit(errA error)
func PlErrSimple ¶
func PlErrSimple(formatA string, argsA ...interface{})
PrlErrSimple 输出错误信息,结尾加一个回车
func PlErrSimpleAndExit ¶
func PlErrSimpleAndExit(formatA string, argsA ...interface{})
func PlSimpleErrorString ¶
func PlSimpleErrorString(strA string)
func PlvWithError ¶
func PlvWithError(vA interface{}, errStrA string)
func PostRequest ¶
PostRequest : another POST request sender
func Printfln ¶
func Printfln(format string, a ...interface{})
Printfln 仅仅封装了fmt.Printf函数,但结尾会多输出一个换行符
func RegContains ¶
func RegFindAll ¶
func RegFindFirst ¶
func RegReplace ¶
func RemoveFileExt ¶
func RemoveGlobalEnv ¶
func RemoveGlobalEnv(vA string)
func RemoveLastSubString ¶
func ReplaceLineEnds ¶
func RestoreLineEnds ¶
func SaveDualLineList ¶
func SaveStringList ¶
func SaveStringListWin ¶
func SaveStringToFile ¶
SaveStringToFile 保存字符串到文件
func SetGlobalEnv ¶
func SetGlobalEnv(vA string)
func SetLogFile ¶
func SetLogFile(fileNameA string)
func ShuffleStringArray ¶
ShuffleStringArray 把字符串数组随机化打乱timesA次
func SleepMilliSeconds ¶
func SleepMilliSeconds(msA int)
func SleepSeconds ¶
func SleepSeconds(secA int)
func SplitLines ¶
func SplitLinesRemoveEmpty ¶
func StartsWith ¶
StartsWith 检查字符串strA开始是否是subStrA
func StartsWithDigit ¶
func StartsWithIgnoreCase ¶
func StartsWithUpper ¶
func StrToIntPositive ¶
func StrToIntWithDefaultValue ¶
StrToIntWithDefaultValue 字符串转扎整数,如果有问题则返回默认数值
func StrToTimeCompactNoError ¶
func StringReplace ¶
func TrimCharSet ¶
Types ¶
type ExitCallback ¶
type ExitCallback func()
type RandomX ¶
type RandomX struct {
// contains filtered or unexported fields
}
RandomX 是一个线程不安全的随机数产生器
func NewRandomGenerator ¶
func NewRandomGenerator() *RandomX
type SimpleEvent ¶
SimpleEvent 简捷的事件结构
func CreateSimpleEvent ¶
func CreateSimpleEvent(typeA string, valueA string) *SimpleEvent
CreateSimpleEvent 创建一个SimpleEvent对象,并为其赋初值
func (*SimpleEvent) Init ¶
func (p *SimpleEvent) Init(typeA string, valueA string)
Init 为SimpleEvent初始化数据
type TXCollection ¶
var GlobalEnvSetG *TXCollection = nil
func CreateTXCollection ¶
func CreateTXCollection(sizeA int) *TXCollection
func (*TXCollection) AddOrSet ¶
func (p *TXCollection) AddOrSet(strA string)
func (*TXCollection) AddOrSetExcludeEmpty ¶
func (p *TXCollection) AddOrSetExcludeEmpty(strA string)
func (*TXCollection) Contains ¶
func (p *TXCollection) Contains(strA string) bool
func (*TXCollection) GetList ¶
func (p *TXCollection) GetList() []string
func (*TXCollection) GetListString ¶
func (p *TXCollection) GetListString(ifUpA bool, sepA string) string
func (*TXCollection) GetSortedList ¶
func (p *TXCollection) GetSortedList(ifUpA bool) []string
func (*TXCollection) InitX ¶
func (p *TXCollection) InitX(sizeA int)
func (*TXCollection) Length ¶
func (p *TXCollection) Length() int
func (*TXCollection) Remove ¶
func (p *TXCollection) Remove(strA string) bool
func (*TXCollection) Size ¶
func (p *TXCollection) Size() int
type TXString ¶
type TXString struct { Err string Obj interface{} // contains filtered or unexported fields }
func CreateString ¶
func CreateStringEmpty ¶
func CreateStringEmpty() *TXString
func CreateStringError ¶
func CreateStringErrorF ¶
func CreateStringSimple ¶
func CreateStringSuccess ¶
func CreateStringSuccess() *TXString
func CreateStringWithObject ¶
func GenerateErrorStringFTX ¶
func GenerateErrorStringTX ¶
func LoadStringTX ¶
func RegFindFirstTX ¶
func (*TXString) ContainsInHtmlAttributeString ¶
func (*TXString) EqualsIgnoreCase ¶
func (*TXString) ErrorString ¶
func (*TXString) ErrorStringF ¶
func (*TXString) InitWithString ¶
func (*TXString) IsEmptyTrim ¶
func (*TXString) JSONString ¶
func (*TXString) PlSuccessOrErr ¶
func (*TXString) PrintResultWithTimeLast ¶
func (p *TXString) PrintResultWithTimeLast()
func (*TXString) PrintWithPrefixTime ¶
func (*TXString) PrintWithPrefixTimeLast ¶
func (*TXString) PrintWithTimeLast ¶
func (p *TXString) PrintWithTimeLast()
func (*TXString) RegReplace ¶
func (*TXString) SplitLines ¶
func (*TXString) StartsWith ¶
func (*TXString) StringEmptyIfError ¶
func (*TXString) ToStringList ¶
func (*TXString) ToStringListRemoveEmpty ¶
type TXStringArray ¶
type TXStringArray []string
func (TXStringArray) Contains ¶
func (aryM TXStringArray) Contains(strA string) bool
func (TXStringArray) ContainsIgnoreCase ¶
func (aryM TXStringArray) ContainsIgnoreCase(strA string) bool
type TXStringSlice ¶
type TXStringSlice struct {
// contains filtered or unexported fields
}