init commit
This commit is contained in:
31
core/util.go
Normal file
31
core/util.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func itoa(n int) string {
|
||||
return strconv.Itoa(n)
|
||||
}
|
||||
|
||||
func hasPrefix(s, prefix string) bool {
|
||||
return strings.HasPrefix(strings.ToLower(s), strings.ToLower(prefix))
|
||||
}
|
||||
|
||||
func lastIndexOf(s string, ch byte) int {
|
||||
return strings.LastIndexByte(s, ch)
|
||||
}
|
||||
|
||||
func splitAt(s string, ch byte) []string {
|
||||
idx := strings.IndexByte(s, ch)
|
||||
if idx < 0 {
|
||||
return []string{s}
|
||||
}
|
||||
return []string{s[:idx], s[idx+1:]}
|
||||
}
|
||||
|
||||
func urlUnescape(s string) (string, error) {
|
||||
return url.PathUnescape(s)
|
||||
}
|
||||
Reference in New Issue
Block a user