DisplayURL returns a copy of the string urlStr removing everything except the scheme, hostname, and path. If the scheme is not specified, "https" is assumed. If there is an error parsing urlStr then urlStr is returned without modification.
(urlStr string)
| 69 | // If the scheme is not specified, "https" is assumed. |
| 70 | // If there is an error parsing urlStr then urlStr is returned without modification. |
| 71 | func DisplayURL(urlStr string) string { |
| 72 | u, err := url.Parse(urlStr) |
| 73 | if err != nil { |
| 74 | return urlStr |
| 75 | } |
| 76 | scheme := u.Scheme |
| 77 | if scheme == "" { |
| 78 | scheme = "https" |
| 79 | } |
| 80 | return scheme + "://" + u.Hostname() + u.Path |
| 81 | } |
| 82 | |
| 83 | // RemoveDiacritics returns the input value without "diacritics", or accent marks |
| 84 | func RemoveDiacritics(value string) string { |
no outgoing calls