performance
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -23,10 +22,13 @@ func ZeroPad(num int, length int) string {
|
|||||||
return strings.Repeat("0", length-len(str)) + str
|
return strings.Repeat("0", length-len(str)) + str
|
||||||
}
|
}
|
||||||
|
|
||||||
var numericRegex = regexp.MustCompile(`^[\d]+$`)
|
|
||||||
|
|
||||||
func IsNumeric(num string) bool {
|
func IsNumeric(num string) bool {
|
||||||
return numericRegex.MatchString(num)
|
for _, c := range num {
|
||||||
|
if c >= '0' && c <= '9' {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func CleanSongTitle(title string, artistName string) string {
|
func CleanSongTitle(title string, artistName string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user