Documentation ¶
Index ¶
- Variables
- func GenRandomName(n int) string
- func GenRandomString(length int, validChars string) string
- func GenUrls(strs ...string) ([]*url.URL, error)
- func GetFFmpegPath() (string, error)
- func GetFuncMap(config *configs.Config) template.FuncMap
- func GetMd5String(b []byte) string
- func IsFFmpegExist() bool
- func Match1(re, str string) string
- func ParseString(str string, filter ...StringFilter) string
- func PrintStack(ctx context.Context)
- type StringFilter
- type StringFilterChain
- type StringFilterFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ParseUnicode = StringFilterFunc(func(str string) string { buf := new(bytes.Buffer) chars := []byte(str) for i := 0; i < len(str); { if chars[i] == 92 && chars[i+1] == 117 { t, _ := strconv.ParseInt(string(chars[i+2:i+6]), 16, 32) buf.WriteString(fmt.Sprintf("%c", t)) i += 6 } else { buf.WriteByte(chars[i]) i++ } } return buf.String() })
View Source
var RemoveSymbolOtherChar = StringFilterFunc(func(str string) string { reg := regexp.MustCompile(`\p{So}`) for reg.MatchString(str) { str = reg.ReplaceAllString(str, "_") } return str })
View Source
var ReplaceIllegalChar = StringFilterFunc(func(str string) string { reg := regexp.MustCompile(`[\/\\\:\*\?\"\<\>\|]|[\.\s]+$`) for reg.MatchString(str) { str = reg.ReplaceAllString(str, "_") } return str })
View Source
var UnescapeHTMLEntity = StringFilterFunc(html.UnescapeString)
Functions ¶
func GenRandomName ¶
func GenRandomString ¶ added in v0.7.6
func GetFFmpegPath ¶ added in v0.6.8
func GetMd5String ¶
func IsFFmpegExist ¶
func IsFFmpegExist() bool
func ParseString ¶
func ParseString(str string, filter ...StringFilter) string
func PrintStack ¶ added in v0.7.8
Types ¶
type StringFilter ¶
type StringFilterChain ¶
type StringFilterChain struct {
// contains filtered or unexported fields
}
func NewStringFilterChain ¶
func NewStringFilterChain(filter ...StringFilter) *StringFilterChain
func (*StringFilterChain) Do ¶
func (c *StringFilterChain) Do(str string) string
type StringFilterFunc ¶
func (StringFilterFunc) Do ¶
func (f StringFilterFunc) Do(s string) string
Click to show internal directories.
Click to hide internal directories.