Documentation
¶
Index ¶
- func Bytes(s string) []byte
- func Capitalize(s string) string
- func ContainsAny(s string, ss ...string) bool
- func ContainsOnly(s, chars string) bool
- func CountNonEmpty(ss ...string) (c int)
- func Cut(s, sep string) (before, after string, found bool)
- func DeDuplicate(base []string) []string
- func DeepSplit(s string) []string
- func DeepSplits(ss []string) []string
- func Diff(cmp, base []string) (add, sub, equal []string)
- func FirstLine(s string) string
- func FoldSpace(s string) string
- func GetIntersection(sliceList ...[]string) []string
- func InStringList(list []string, want string) bool
- func LeftPad(s, pad string, c int) string
- func LeftPadSpace(s string, minLength int) string
- func ListToInt(ss []string) ([]int, error)
- func ListToInterface(ss []string) []interface{}
- func Merge(list ...[]string) []string
- func PopInStringList(list []string, want string) (bool, []string)
- func RightPad(s, pad string, c int) string
- func RightPadSpace(s string, minLength int) string
- func ToReader(s string) io.Reader
- func TrimEmptyLine(s string) string
- func UnsafeToBytes(s string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capitalize ¶
Capitalize convert first letter to upper and others remain
func ContainsAny ¶ added in v0.4.27
ContainsAny returns true if s contains any specified substring
func ContainsOnly ¶
func Cut ¶
Cut slices s around the first instance of sep, returning the text before and after sep. The found result reports whether sep appears in s. If sep does not appear in s, cut returns s, "", false.
Port from Go 1.18 https://cs.opensource.google/go/go/+/refs/tags/go1.18beta1:src/strings/strings.go;l=1177
func DeDuplicate ¶
func DeepSplits ¶
func Diff ¶
Diff 给出两个数组,返回二者的差异 返回值 1 为 cmp 比 base 增加的元素 返回值 2 为 cmp 比 base 减少的元素 这一函数的时间和空间复杂度均为 O(M+N)
func GetIntersection ¶
func InStringList ¶
func LeftPadSpace ¶ added in v0.4.26
func ListToInterface ¶
func ListToInterface(ss []string) []interface{}
ListToInterface 将 []string 转换为 []interface
func PopInStringList ¶
PopInStringList 如果元素在列表中,则返回 true 与删除元素后的列表,否则返回 false 与原列表
func RightPadSpace ¶
func UnsafeToBytes ¶
UnsafeToBytes 将 string 转换为 []byte,避免拷贝导致的内存开销 需要注意的是,如果试图对返回的 []byte 进行修改可能会导致程序直接崩溃
Types ¶
This section is empty.