Skip to content
Snippets Groups Projects
Commit a4db9465 authored by Francé Wilke's avatar Francé Wilke
Browse files

Merge branch 'string-utils-remove-querystring-from-url' into 'main'

adds StripQueryString()

See merge request uafrica/go-utils!24
parents 09da61be 57a7526c
No related branches found
No related tags found
1 merge request!24adds StripQueryString()
......@@ -294,3 +294,13 @@ func LimitStringToMaxLength(str string, maxLen int) string {
}
return str
}
// StripQueryString - Strips the query parameters from a URL
func StripQueryString(inputUrl string) (string, error) {
u, err := url.Parse(inputUrl)
if err != nil {
return inputUrl, err
}
u.RawQuery = ""
return u.String(), nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment