/*
Removes a parameter and its value from the query string of a full URL.
514998
static function removeUrlParam($url, $key)
    {
        $url = self::completeLocalPath($url);

        // If not a valid URL, return false.
        if(!self::validateUrl($url)){
            throw new \Exception('Invalid URL '.$url);
        }

        $urlParts = parse_url($url);

        // If the URL has no query string, we're done.
        if(!isset($urlParts['query'])){
            return $url;
        } else {
            $url = str_replace('?'.$urlParts['query'], '', $url);
        }

        // Remove hash before we parse for the parameter.
        if(isset($urlParts['fragment'])) {
            $url = str_replace('#'.$urlParts['fragment'], '', $url);
        }

        parse_str( $urlParts['query'], $queryParts );
        if(isset($queryParts[$key])) {
            unset($queryParts[$key]);
        }

        $urlParts['query'] = '';

        if(is_array($queryParts) && count($queryParts)) {
            foreach ($queryParts as $paramKey => $paramVal) {
                $urlParts['query'] .= $paramKey . '=' . $paramVal . '&';
            }
            $urlParts['query'] = '?'.rtrim($urlParts['query'], '&');
            $url = $url.$urlParts['query'];
        }

        if(isset($urlParts['fragment'])){
            $url .= '#'.$urlParts['fragment'];
        }

        return $url;
    }
1241957
function (url, paramName, paramValue)
    {
      // if the specified url is valid
      var urlAsObject = Url.parse(url);
      if (urlAsObject)
      {
        // if the url already has query parameters, use '&' as the separator
        // when appending the additional query parameter, otherwise use '?'
        url += (urlAsObject.search ? '&' : '?') + paramName + '=' + paramValue;
      }

      return url;
    }
949275
protected function dropLinkedInParams($query)
    {
        if ($query == '') {
            return '';
        }

        $params = explode('&', $query);
        foreach ($params as $i => $param) {
            /*
             * A key or key/value pair might me 'foo=bar', 'foo=', or 'foo'.
             */
            //get the first value of the array you will get when you explode()
            list($key) = explode('=', $param, 2);
            if (in_array($key, self::$knownLinkedInParams)) {
                unset($params[$i]);
            }
        }

        //assert: params is an array. It might be empty
        if (!empty($params)) {
            return '?'.implode($params, '&');
        }

        return '';
    }
1295891
function removeUrlPath (uri) {
  var parsed = url.parse(uri);
  if (parsed.host) {
    delete parsed.pathname;
  }
  return url.format(parsed);
}
46320
public void removeNameUrl(final String name, final String url) 
	throws IOException {
		doPostMethod(ResourceFileLocationDBServlet.REMOVE_OPERATION, name, url);
	}
1105420
public function removeQueryString(array $params, $url = null)
    {
        $strUrl = static::prepareUrl($url);

        if (empty($params)) {
            return $strUrl;
        }

        $explodedUrl = explode('?', $strUrl, 2);

        if (2 === \count($explodedUrl)) {
            list($script, $queryString) = $explodedUrl;
        } else {
            list($script) = $explodedUrl;

            return $script;
        }

        parse_str($queryString, $queries);

        $queries = array_filter($queries);
        $queries = array_diff_key($queries, array_flip($params));

        $href = '';

        if (!empty($queries)) {
            $href .= '?'.http_build_query($queries, '', '&');
        }

        return $script.$href;
    }
678126
private String removeLocalParamPrefix(final String q) {

        int index = q.indexOf('}');
        if (index >= 0) {
            return q.substring(index + 1);
        }
        return q;
    }
451867
public static function removeUrlParams($url,$removeKeys)
    {
        if(empty($removeKeys)){
            return $url;
        }
        $pos=strpos($url, "?");
        if($pos>0 || $pos===0){
            $baseUrl=substr($url, 0,$pos);
            $paramStr=substr($url, $pos+1);
            if(empty($paramStr)){
                return $url;
            }
            $params=explode("&", $paramStr);
            $paramStr="";
            foreach ($params as $param){
                $kv=explode("=", $param);
                if(!in_array($kv[0], $removeKeys)){
                    $paramStr.="&".$kv[0]."=".(count($kv)>1?$kv[1]:"");
                }
            }
            if(!empty($paramStr)){
                $paramStr=substr($paramStr, 1);
            }
            if(!empty($paramStr)){
                $baseUrl=$baseUrl."?".$paramStr;
            }
            return $baseUrl;
        }else{
            return $url;
        }
    }
299451
public static String doDelete(String url, Map<String, String> header, Map<String, String> params) throws IOException {
    return doRequestWithUrl(url, METHOD_DELETE, header, params, DEFAULT_CHARSET);
  }
489887
function _cleanURL(url) {
        var index = url.search(/[#\?]/);
        if (index >= 0) {
            url = url.substr(0, index);
        }
        return url;
    }
610046
@Nonnull
  public URLParameterList remove (@Nullable final String sName, @Nullable final String sValue)
  {
    removeIf (aParam -> aParam.hasName (sName) && aParam.hasValue (sValue));
    return this;
  }
75924
function cleanUp() {
    publicAPI.removeRenderObserver(model.view_id);
    publicAPI.unsubscribeRenderTopic();
    while (model.urlToRevoke.length) {
      window.URL.revokeObjectURL(model.urlToRevoke.pop());
    }
  }
39470
function(url, key, value) {
    var queryStrPos = url.indexOf('?');
    var anchorStrPos = url.lastIndexOf('#');
    
    var paramSeparator = '&';
    
    if(queryStrPos < 0) {
        // There's no query string.
        paramSeparator = '?';
    }
    
    if (anchorStrPos > 0) {
        // There's an anchor at the end, we need to insert our parameter before it
        var urlBeforeAnchor = url.substring(0, anchorStrPos);
        var urlAnchor = url.substring(anchorStrPos);
        return urlBeforeAnchor + paramSeparator + key + '=' + value + urlAnchor;
    } else {
        return url + paramSeparator + key + '=' + value;
    }
}
108902
function getQueryParameterValue(url, parameterName) {
        var parts;
        var query = (url || '').split('?');
        if (query && query.length > 0) {
            parts = query[1];
        }
        else {
            parts = '';
        }
        var vars = parts.split('&');
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split('=');
            if (decodeURIComponent(pair[0]) == parameterName) {
                return decodeURIComponent(pair[1]);
            }
        }
        // not found
        return null;
    }
1260840
public function cleanParameterUrls($urls)
    {
        if (!is_array($urls)) {
            $urls = array($urls);
        }

        $urls = array_filter($urls);
        $urls = array_map('urldecode', $urls);

        foreach ($urls as &$url) {
            $url = $this->removeTrailingSlash($url);
            $scheme = parse_url($url, PHP_URL_SCHEME);
            if (empty($scheme)
                && strpos($url, '://') === false
            ) {
                $url = 'http://' . $url;
            }
            $url = trim($url);
            $url = Common::sanitizeInputValue($url);
        }

        $urls = array_unique($urls);
        return $urls;
    }
226929
public static String cleanParam(String[] strParams, boolean bSetDefault, String strDefault)
    {
        if ((strParams == null) || (strParams.length == 0))
            strParams = new String[1];
        if (strParams[0] == null) if (bSetDefault)
            strParams[0] = strDefault;
        if (strParams[0] == null)
            return null;
        try   {
            return URLDecoder.decode(strParams[0], DBConstants.URL_ENCODING);
        } catch (java.io.UnsupportedEncodingException ex) {
            return strParams[0];
        }
    }
1069077
function del(url, fn){
  var req = request('DELETE', url);
  if (fn) req.end(fn);
  return req;
}