Ai
9 Star 45 Fork 10

卧雪Sirk/gosk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
strutil.go 484 Bytes
一键复制 编辑 原始数据 按行查看 历史
leofen 提交于 2014-02-22 16:56 +08:00 . fix code hightlight bug
package gosk
import (
"log"
"regexp"
)
func trimHTML(str string) string {
if str == "" {
return str
}
re, _ := regexp.Compile(`<[\s\S]+?(>|$)`)
newstr := re.ReplaceAllString(str, "")
return newstr
}
func subStr(str string, start, end int) string {
if start < 0 {
log.Panic("start position is wrong!")
}
if end > len(str) {
log.Panic("end positon is wrong!")
}
if start > end {
log.Panic("wrong position!")
}
rs := []rune(str)
return string(rs[start:end])
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/scottkiss/gosk.git
git@gitee.com:scottkiss/gosk.git
scottkiss
gosk
gosk
master

搜索帮助