Categorygithub.com/yudeguang/stringx
modulepackage
0.0.0-20221123055633-f59a4b8f1188
Repository: https://github.com/yudeguang/stringx.git
Documentation: pkg.go.dev

# Functions

返回第一次出现sep之后的字串符.
返回最后一次出现sep之后的字符串.
返回第N次出现sep之后的字符串.
返回第一次出现sep之前的字符串.
返回最后一次出现sep之前的字符串.
返回第N次出现sep之前的字符串.
返回第一次出现在两个字符串接之间的字符串.
返回把中间字符按一定规则替换后的字符串接CenterPad("hello", 10, "*") => "he*****llo".
只保留逗号以及数字和英文字母,因为逗号一般用于分隔文本.
判断rune是否包含汉字.
生成crc32.
HTML中,经常有换行符号,前后有空格等.
GB18030转换为UTF8,应优先使用GB18030,GB18030为GBK的超集,GBK又为GB2312的超集.
GB2312转换为utf8.
GBK转换为utf8.
只保留字符串中的汉字.
判断字符串是否是由纯字母组成.
判断是否是小写字母.
判断是否是大写字母.
判断字符串是否是由纯数字组成.
用分隔符sep把若干个字符或int,double等类型数据拼接在一起,实际为strings.Join的变体形式 func JoinInterface(sep string, args ...interface{}) string { l := len(args) switch l { case 0: return "" case 1: return fmt.Sprint(args[0]) case 2: return fmt.Sprint(args[0]) + sep + fmt.Sprint(args[1]) case 3: return fmt.Sprint(args[0]) + sep + fmt.Sprint(args[1]) + sep + fmt.Sprint(args[2]) } var buffer bytes.Buffer //前面若干条中间要加sep for i := 0; i < l-1; i++ { buffer.WriteString(fmt.Sprint(args[i]) + sep) } //最后次不加sep buffer.WriteString(fmt.Sprint(args[l-1])) return buffer.String() } */.
No description provided by the author
用分隔符sep把若干个字符拼接在一起,实际为strings.Join的变体形式.
返回左侧N个字符.
返回字符串str,左面用字符串padstr填补直到str是len个字符长,,此函数与mysql中LPAD()行为保持一致 LeftPad("hello", 4, " ") => "hello" LeftPad("hello", 10, " ") => " hello" LeftPad("hello", 10, "123") => "12312hello".
返回两侧字符按一定规则替换后的字符串接 LeftRightPad("hello", 4, " ") => "hell" LeftRightPad("hello", 10, " ") => " hello " LeftRightPad("hello", 10, "123") => "12hello123".
只保留英文字母.
生成md5.
返回最相似的一个字符串,前缀匹配优先 用于特定的项目 如果一点相似度都没有,则返回空.
返回经过筛选后的若干条数据,按近似程度从高到低排序.
返回相似度最高的那个字符串 并且带匹配度 此为通用算法.
只保留阿拉伯数字.
只保留数字和英文字母,删除其它类型字母及标点符号.
返回随机打乱后的字符串.
保留输入的相关字符.
移除字符串中的汉字.
返回倒序字符串.
返回右侧N个字符.
返回字符串str,右面用字符串padstr填补直到str是len个字符长,此函数与mysql中RPAD()行为保持一致 Rightpad("hello", 4, " ") => "hello" Rightpad("hello", 10, " ") => "hello " Rightpad("hello", 10, "123") => "hello12312".
判断单个rune是否是汉字.
生成sha1.
按固定的长度拆分字符串.
UTF8转GB18030,注意,打印出来一般是乱码.
UTF8转GB2312,注意,打印出来一般是乱码.
UTF8转GBK,注意,打印出来一般是乱码.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author