1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-11-02 00:23:01 +00:00

Make navi-title better

This commit is contained in:
bouncepaw
2021-01-10 16:58:02 +05:00
parent b1f33c872c
commit d19adf6729
4 changed files with 17 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import (
"crypto/rand"
"encoding/hex"
"net/http"
"path"
"strings"
)
@@ -55,3 +56,8 @@ func RandomString(n int) (string, error) {
}
return hex.EncodeToString(bytes), nil
}
// Strip hypha name from all ancestor names, replace _ with spaces, title case
func BeautifulName(uglyName string) string {
return strings.Title(strings.ReplaceAll(path.Base(uglyName), "_", " "))
}