Documentation ¶
Overview ¶
可以完成针对字符串的高级操作
Index ¶
- func DouExstact(src string, sym string) ([]string, error)
- func DouExstactReplace(src string, sym string, value map[string]interface{}) (string, error)
- func RemoveMultipeSpace(oldStr string) (newStr string)
- func ReplaceAscii(src string, seg []string) string
- func Reverse(src, seg string) string
- func ReverseWithSeg(src, oldSeg, newSeg string) string
- func SymExstact(src string, sym1, sym2 string) ([]string, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DouExstact ¶
DouExstact 标准截取. 从src中按照指定的sym进行截取sym之间的字符 例如从#ABC#abc#DEF#中截取出 ABC和DEF
Example ¶
src := "#ABC#DEF#HHH#eee" sub, err := DouExstact(src, "#") if err != nil { log.Fatalln(err) } log.Println(sub)
Output:
func DouExstactReplace ¶
DouExstactReplace 标准替换, 从src中按照指定的sym进行提取,并从value中获取相对应的val 替换到指定位置
func RemoveMultipeSpace ¶
RemoveMultipeSpace 去除字符串中多余的空格
func ReplaceAscii ¶
ReplaceAscii 替换src当中指定的字符串类型的控制字符 例如将 字符串类型的"\n"替换成 Ascii的 10(LF)
func ReverseWithSeg ¶
ReverseWithSeg 将源字符串按照指定的分隔符进行反转,同时使用新分隔符替代旧分隔符 例如: src = www.mydomain.com.cn, newSeg="-" dist = cn-com-mydomian-www
func SymExstact ¶
SymExstact 对称截取. 从src中截取sym1与sym2之间的字符 例如从{ABC}abc{CHD}中按照'{','}'进行截取,最后会截取到 ABC和CHD
Example ¶
src := "{ABC}abc{DEF}jhi" sub, err := SymExstact(src, "{", "}") if err != nil { log.Fatalln(err) } log.Println(sub)
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.