package beego
import (
"fmt"
"html/template"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
"strings"
"time"
)
func webTime(t time.Time) string {
ftime := t.Format(time.RFC1123)
if strings.HasSuffix(ftime, "UTC") {
ftime = ftime[0:len(ftime)-3] + "GMT"
}
return ftime
}
func Substr(s string, start, length int) string {
bt := []rune(s)
if start < 0 {
start = 0
}
var end int
if (start + length) > (len(bt) - 1) {
end = len(bt)
} else {
end = start + length
}
return string(bt[start:end])
}
// Html2str() returns escaping text convert from html
func Html2str(html string) string {
src := string(html)
//将HTML标签全转换成小写
re, _ := regexp.Compile("\\<[\\S\\s]+?\\>")
src = re.ReplaceAllStringFunc(src, strings.ToLower)
//去除STYLE
re, _ = regexp.Compile("\\