32 lines
537 B
Go
32 lines
537 B
Go
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)
|
|
}
|