Golang 截取字符串
//Substring 截取字符串
func Substring(source string, start int, end int) string {
var r = []rune(source)
length := len(r)
if start < 0 || end > length || start > end {
return ""
}
if start == 0 && end == length {
return source
}
return string(r[start:end])
}
版权声明:本文著作权归原作者所有,如有侵权,请联系我们立即删除!