Skip to content
Snippets Groups Projects
Commit 57af2640 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Merge branch 'main' of gitlab.com:uafrica/go-utils

parents 03ad9f93 4f608888
Branches
Tags
No related merge requests found
...@@ -3,6 +3,7 @@ package string_utils ...@@ -3,6 +3,7 @@ package string_utils
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/url"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
...@@ -280,3 +281,9 @@ func SplitString(str string, sep []rune) []string { ...@@ -280,3 +281,9 @@ func SplitString(str string, sep []rune) []string {
return splitStrings return splitStrings
} }
// IsUrlStrict Returns whether a URL is valid in a strict way (Must have scheme and host)
func IsUrlStrict(str string) bool {
u, err := url.Parse(str)
return err == nil && u.Scheme != "" && u.Host != ""
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment