2023-07-16 19:48:39 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/rand"
|
2023-08-08 19:32:24 +00:00
|
|
|
"strings"
|
2023-07-16 19:48:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
|
|
|
|
|
|
|
func RandStringRunes(n int) string {
|
|
|
|
b := make([]rune, n)
|
|
|
|
for i := range b {
|
|
|
|
b[i] = letterRunes[rand.Intn(len(letterRunes))]
|
|
|
|
}
|
|
|
|
return string(b)
|
|
|
|
}
|
2023-08-08 19:32:24 +00:00
|
|
|
|
|
|
|
func UrlToEntryId(url string) string {
|
|
|
|
parts := strings.Split(url, "/")
|
|
|
|
if parts[len(parts)-1] == "" {
|
|
|
|
return parts[len(parts)-2]
|
|
|
|
} else {
|
|
|
|
return parts[len(parts)-1]
|
|
|
|
}
|
|
|
|
}
|