mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-19 16:21:43 +01:00
restructured the project to comply community guideline, for others check release note
This commit is contained in:
23
internal/utils/string.go
Normal file
23
internal/utils/string.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func CommaSeperatedList(s string) []string {
|
||||
res := strings.Split(s, ",")
|
||||
for i, part := range res {
|
||||
res[i] = strings.TrimSpace(part)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func ExtractPort(fullURL string) (int, error) {
|
||||
url, err := url.Parse(fullURL)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return strconv.Atoi(url.Port())
|
||||
}
|
||||
Reference in New Issue
Block a user