Documentation ¶
Index ¶
- func AbsInt(n int) int
- func AppendStringToFile(strA string, fileNameA string) string
- func ByteToString(valueA byte) string
- func CalCosSim(f1, f2 []float64) float64
- func CalCosSimBig(f1, f2 []float64) float64
- func CalPi(pointCountA int) float64
- func CalPiX(pointCountA int) float64
- func ConvertBytesFromGB18030ToUTF8(srcA []byte) []byte
- func ConvertBytesFromISO8859_1ToUTF8(srcA []byte) []byte
- func ConvertBytesFromUTF8ToGB18030(srcA []byte) []byte
- func DownloadPageUTF8(urlA string, postDataA url.Values, timeoutSecsA time.Duration) (string, error)
- func DrawLine(imageA *image.NRGBA, x1, y1, x2, y2 int, colorA color.Color)
- func EndsWith(strA string, subStrA string) bool
- func Fibonacci(c int64) int64
- func FileExists(fileNameA string) bool
- func FlagExists(argsA []string, flagA string) bool
- func GenerateRandomString(minCharCountA, maxCharCountA int, ...) string
- func GenerateRandomStringX(minCharCountA, maxCharCountA int, ...) string
- func GetFileTypeByHead(fileNameA string) (string, error)
- func GetFlag(argsA []string, flagA string) string
- func IntToString(valueA int) string
- func IntegerToString(valueA interface{}) string
- func IsDirectory(dirNameA string) bool
- func IsFile(fileNameA string) bool
- func LoadLinesFromFile(fileNameA string, limitA int) string
- func LoadStringFromFile(fileNameA string, defaultA string) string
- func LoadStringListFromFile(fileNameA string) []string
- func NumberToString(valueA interface{}) string
- func Printf(format string, a ...interface{})
- func Printfln(format string, a ...interface{})
- func Randomize()
- func SaveStringToFile(strA string, fileNameA string) string
- func StartsWith(strA string, subStrA string) bool
- func StringToInt(strA string) (int, error)
- func Trim(strA string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendStringToFile ¶
AppendStringToFile 向文件中追加字符串,如果文件不存在则新建该文件后再追加
func CalCosSimBig ¶
CalCosSimBig 计算两个向量的余弦相似度,使用big包避免计算溢出
func ConvertBytesFromGB18030ToUTF8 ¶
ConvertBytesFromGB18030ToUTF8 转换GB18030编码的字节切片为UTF-8编码
func ConvertBytesFromISO8859_1ToUTF8 ¶
ConvertBytesFromISO8859_1ToUTF8 转换ISO-8859-1编码的字节切片为UTF-8编码
func ConvertBytesFromUTF8ToGB18030 ¶
ConvertBytesFromUTF8ToGB18030 转换UTF-8编码的字节切片为GB18030编码
func DownloadPageUTF8 ¶
func DownloadPageUTF8(urlA string, postDataA url.Values, timeoutSecsA time.Duration) (string, error)
DownloadPageUTF8 用于下载UTF-8或兼容UTF-8编码的网页
func FlagExists ¶
FlagExists 判断命令行参数中是否存在开关,用法:flag := FlagExists(args, "-value")
func GenerateRandomString ¶
func GenerateRandomString(minCharCountA, maxCharCountA int, hasUpperA, hasLowerA, hasDigitA, hasSpecialCharA, hasSpaceA bool, hasOtherChars bool) string
GenerateRandomString 生成一个可定制的随机字符串
func GenerateRandomStringX ¶
func GenerateRandomStringX(minCharCountA, maxCharCountA int, hasUpperA, hasLowerA, hasDigitA, hasSpecialCharA, hasSpaceA bool, hasOtherChars bool) string
GenerateRandomStringX 生成一个可定制的随机字符串,使用strings.Builder效率更高
func GetFileTypeByHead ¶
GetFileTypeByHead 根据文件头的特殊字节判断常见文件类型
func GetFlag ¶
GetFlag 检查命令行切片中是否存在某标志参数,如果存在则返回该标志参数的值,否则返回空字符串 例:如果对命令行 “clix calbmi -w=70.0 -h=1.75”调用GetFlag(args, "-w="),则结果为字符串“70.0”
func IntegerToString ¶
func IntegerToString(valueA interface{}) string
IntegerToString 所有整数类型转换为string类型
func LoadLinesFromFile ¶
LoadLinesFromFile 从文件中读取指定数量的行
func LoadStringFromFile ¶
LoadStringFromFile 从文件中读取所有内容并返回为字符串,如果出错则返回defaultA参数指定的字符串
func LoadStringListFromFile ¶
LoadStringListFromFile 从文件中读取所有内容并返回为字符串切片,文件中每行为字符串切片中的一项
func NumberToString ¶
func NumberToString(valueA interface{}) string
NumberToString 所有主要数字类型转换为string类型
func Printfln ¶
func Printfln(format string, a ...interface{})
Printfln 仅仅封装了fmt.Printf函数,但结尾会多输出一个换行符
func SaveStringToFile ¶
SaveStringToFile 将字符串存入文件,如有原来有同名文件则其内容将被冲掉
func StartsWith ¶
StartsWith 检查字符串strA开始是否是subStrA
Types ¶
This section is empty.