Documentation ¶
Index ¶
- Variables
- func ContainAtLeastOneEqualFold(s1 []string, s2 []string) bool
- func ContainString(s []string, v string) bool
- func ContainStringEqualFold(s []string, v string) bool
- func DeepCopy(src interface{}) interface{}
- func FilePutContents(filename string, content []byte) error
- func IsEmpty(value interface{}) bool
- func KVListApplyFunc(f func(k, v string) bool, kv ...string) error
- func KVListToFlagArgs(kv ...string) ([]string, error)
- func LD(s, t string, ignoreCase bool) int
- func PanicErr(err error)
- func PanicErrWithWrap(err error, fmtStr string, args ...interface{})
- func ReadAll(r io.Reader) ([]byte, error)
- func SnakeCase(str string) string
- func StringMaxLen(ss []string, lenFunc func(s string) int) (max int)
- func StringMaxLenByRune(ss []string) int
- func StringSliceWalk(vs []string, f func(string) (string, bool)) []string
- func StringTrim(str string, characterMask ...string) string
- func TableFormat(lineAll []string, magic string, seperateLine bool, suffixLines ...string) string
- func TableFormatLines(lineAll []string, magic string) []string
- func TermSize() (int, int, error)
- func ToCleanStringSlice(in string) []string
- func WrapIfErr(err error, fmtStr string, args ...interface{}) error
- func WrapIfErrAsFisrt(err error, fmtStr string, args ...interface{}) error
- func YAMLWithComments(data interface{}, atIndent int, yamlTag string, usageTag string, ...) (string, error)
- type DeepCopyInterface
Constants ¶
This section is empty.
Variables ¶
var DefaultTrimChars = string([]byte{
'\t',
'\v',
'\n',
'\r',
'\f',
' ',
0x00,
0x85,
0xA0,
})
DefaultTrimChars are the characters which are stripped by Trim* functions in default.
var StringSliceEmptyFilter = func(s string) (string, bool) { return s, s != "" }
StringSliceEmptyFilter StringSliceWalk的filter,过滤空字符串
var TerminalWidthMin = 80
TerminalWidthMin 最小终端宽度,当获取的宽度小于等于该值,不再做换行优化
var TerminalWidthRate float32 = 0.9
TerminalWidthRate 输出时占用的宽度比例
Functions ¶
func ContainAtLeastOneEqualFold ¶
ContainAtLeastOneEqualFold s1是否至少含有s2中的一个元素
func ContainStringEqualFold ¶
ContainStringEqualFold 是否含有字符串不区分大小写
func DeepCopy ¶ added in v0.2.9
func DeepCopy(src interface{}) interface{}
DeepCopy creates a deep copy of whatever is passed to it and returns the copy in an interface{}. The returned value will need to be asserted to the correct type.
func FilePutContents ¶ added in v0.3.12
func IsEmpty ¶ added in v0.3.9
func IsEmpty(value interface{}) bool
IsEmpty [影响性能] 返回value是否为空,如value为0,nil,false,"",len(slice/map/chan) == 0会返回true,否则返回false
func KVListApplyFunc ¶
KVListApplyFunc kv利用给定的f进行k,v遍历
func KVListToFlagArgs ¶
KVListToFlagArgs 将kv转换为Flag格式字符串列表
func LD ¶ added in v0.2.7
LD compares two strings and returns the levenshtein distance between them.
func PanicErrWithWrap ¶
PanicErrWithWrap err不为nil则panic,error类型使用fmtStr格式化
func StringMaxLen ¶
StringMaxLen ss中的字符串最长值
func StringMaxLenByRune ¶ added in v0.2.7
StringMaxLenByRune ss中的字符串最长值,使用rune计算
func StringSliceWalk ¶
StringSliceWalk 遍历vs,将f应用到每一个元素,返回更新后的数据
func TableFormat ¶
TableFormat table格式化lineAll,对齐
func TableFormatLines ¶ added in v0.2.6
TableFormatLines fotmat return lines
func ToCleanStringSlice ¶
ToCleanStringSlice 分割字符串,trim字符
func WrapIfErrAsFisrt ¶
WrapIfErrAsFisrt err不为nil则wrap,将err作为第一个fmt的参数
Types ¶
type DeepCopyInterface ¶ added in v0.2.9
type DeepCopyInterface interface {
DeepCopy() interface{}
}
DeepCopyInterface for delegating copy process to type