This commit is contained in:
YouROK
2020-11-06 16:49:18 +03:00
parent a1e17b1cf3
commit f92b9eebf3
11 changed files with 83 additions and 60 deletions

View File

@@ -2,20 +2,9 @@ package utils
import (
"fmt"
"regexp"
"strconv"
"strings"
)
func CleanFName(file string) string {
re := regexp.MustCompile(`[ !*'();:@&=+$,/?#\[\]~"{}]`)
ret := re.ReplaceAllString(file, `_`)
ret = strings.Replace(ret, "__", "_", -1)
ret = strings.Replace(ret, "._", "_", -1)
ret = strings.Replace(ret, "_.", ".", -1)
return ret
}
const (
_ = 1.0 << (10 * iota) // ignore first value by assigning to blank identifier
KB