Files
spilltea/internal/util/util.go
T
2026-05-12 19:12:29 +02:00

19 lines
312 B
Go

package util
import "strings"
func Truncate(s string, max int) string {
if len(s) <= max {
return s
}
return s[:max-1] + "…"
}
// InferScheme returns "http" for port 80, "https" otherwise.
func InferScheme(host string) string {
if strings.HasSuffix(host, ":80") {
return "http"
}
return "https"
}