Eliminate the query string from a URL
@param {string} URL
489887
function _cleanURL(url) {
        var index = url.search(/[#\?]/);
        if (index >= 0) {
            url = url.substr(0, index);
        }
        return url;
    }
396323
function( url ) {
			var parts = this.path.split('/'),
				other_parts = url.split('/'),
				result = '';
			while ( parts.length > 0 && other_parts.length > 0 && parts[0] == other_parts[0] ) {
				parts.shift();
				other_parts.shift();
			}
			each(other_parts, function(){ result += '../'; })
			return result + parts.join('/');
		}
675713
function formatUrl (url, query) {
  let protocol
  let index = url.indexOf('://')
  if (index !== -1) {
    protocol = url.substring(0, index)
    url = url.substring(index + 3)
  } else if (url.indexOf('//') === 0) {
    url = url.substring(2)
  }

  let parts = url.split('/')
  let result = (protocol ? protocol + '://' : '//') + parts.shift()

  let path = parts.filter(Boolean).join('/')
  let hash
  parts = path.split('#')
  if (parts.length === 2) {
    path = parts[0]
    hash = parts[1]
  }

  result += path ? '/' + path : ''

  if (query && JSON.stringify(query) !== '{}') {
    result += (url.split('?').length === 2 ? '&' : '?') + formatQuery(query)
  }
  result += hash ? '#' + hash : ''

  return result
}
896813
protected String removeQueryAndFragment(String url) {
        if (url == null) {
            return url;
        }
        String cleanUrl = url;

        int queryIndex = url.indexOf("?");
        int fragmentIndex = url.indexOf("#");
        if (queryIndex > 0) {
            if (fragmentIndex > 0 && fragmentIndex < queryIndex) {
                // Found fragment before the query string; remove everything after fragment
                cleanUrl = url.substring(0, fragmentIndex);
            } else {
                // Didn't find fragment or fragment is after query string; remove everything after query string
                cleanUrl = url.substring(0, queryIndex);
            }
        } else if (fragmentIndex > 0) {
            // No query string, but did find a fragment
            cleanUrl = url.substring(0, fragmentIndex);
        }
        return cleanUrl;
    }
1071001
function removeOauthResultFromCurrentUrl() {
  if (window.history && window.history.replaceState) {
    var url = window.location.href;
    var hashIndex = url.indexOf('#');
    window.history.replaceState({},
      document.title, url.substring(0, hashIndex));
  } else {
    window.location.hash = '';
  }
}
484866
function cleanUrl(url) {
    "use strict";
    if (url.toLowerCase().indexOf('http') !== 0) {
        return url;
    }
    var a = document.createElement('a');
    a.href = url;
    return a.href;
}
690404
function removeURL( $url )
    {
        $dir = eZDir::path( array( $this->staticStorageDir, $url ) );

        @unlink( $dir . "/index.html" );
        @rmdir( $dir );
    }
623756
function stripTrailingSlash(url) {
        var arr = url.split('/');
        if (arr[arr.length - 1] === '') {
            arr.pop();
        }
        return arr.join('/');
    }
903238
function shortenUrl ( url , length ) {

  if( !isBlank( url ) && url.length > length) {
      url = url.substr( 0 , length ) + "...";
  }

  return url;
}
710168
function(href) {
		var url = extract(href)
		var queryObj = omit(url.qs, this.config.excludeRequestParams)

		var desiredUrlParams = Object.keys(queryObj).map(function(paramName) {
			return paramName + '=' + encodeURIComponent(queryObj[paramName])
		}).join('&')

		return desiredUrlParams ? url.url + '?' + desiredUrlParams : url.url
	}
300988
function (url) {
            return url
                .replace(/[\/]+/g, '/')
                .replace(/\/\?/g, '?')
                .replace(/\/\#/g, '#')
                .replace(/\:\//g, '://');
        }
542528
public static String removeQueryParameter(String url, String key) {
    String[] urlParts = url.split("\\?");

    if (urlParts.length == 2) {
      Map<String, List<String>> paramMap = extractParametersFromQueryString(urlParts[1]);
      if (paramMap.containsKey(key)) {
        String queryValue = paramMap.get(key).get(0);
        String result = url.replace(key + "=" + queryValue, "");
        // improper separators have to be fixed
        // @TODO find a better way to solve this
        result = result.replace("?&", "?").replace("&&", "&");
        if (result.endsWith("&")) {
          return result.substring(0, result.length() - 1);
        } else {
          return result;
        }
      }
    }
    return url;
  }
2220
def clean_url(url, replacement='_'):
        
        cleaned = re.sub(r'/$', '', re.sub(r'https?://', '', url))
        for character in '/ _ ? & : ; %'.split():
            cleaned = cleaned.replace(character, replacement)
        return cleaned
679241
private function cleanUrl($url)
    {
        if (strlen($url) > 1 && strrpos($url, '/') === strlen($url) - 1) {
            $url = substr($url, 0, -1);
        }
        if (strrpos($url, '.php') === strlen($url) - 4) {
            $url = substr($url, 0, -4);
        }
        return $url;
    }
517032
def strip_querystring(url):
    """"""
    p = six.moves.urllib.parse.urlparse(url)
    return p.scheme + "://" + p.netloc + p.path
267516
function formatParamUrl (url) {
  var start = url.indexOf('/:')
  if (start === -1) return url

  var end = url.indexOf('/', ++start)

  if (end === -1) {
    return url.slice(0, start) + '{' + url.slice(++start) + '}'
  } else {
    return formatParamUrl(url.slice(0, start) + '{' + url.slice(++start, end) + '}' + url.slice(end))
  }
}
798505
protected function RemoveQueryString($url, Request $request)
    {
        if (isset($url) && !empty($url)) {
            $parts = explode('&', $url);

            if (strpos($parts[0], '=') === false) {
                $url = $parts[0];
            } else {
                $url = self::RemoveQueryString($request->getQueryString());
            }
        }

        return $url;
    }