initial support of homepage labels

This commit is contained in:
yusing
2024-10-03 02:53:05 +08:00
parent ae61a2335d
commit 90130411f9
7 changed files with 76 additions and 39 deletions

View File

@@ -5,9 +5,13 @@ import (
"strconv"
"strings"
E "github.com/yusing/go-proxy/internal/error"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
// TODO: support other languages
var titleCaser = cases.Title(language.AmericanEnglish)
func CommaSeperatedList(s string) []string {
res := strings.Split(s, ",")
for i, part := range res {
@@ -16,8 +20,8 @@ func CommaSeperatedList(s string) []string {
return res
}
func IntParser(value string) (int, E.NestedError) {
return E.Check(strconv.Atoi(value))
func Title(s string) string {
return titleCaser.String(s)
}
func ExtractPort(fullURL string) (int, error) {