Remove the given key from the url query string and return the new URL as String.

@param url
The URL from which parameters are extracted.
@param key
the key, that should be removed
@return the modified URL as String
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;
  }
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;
    }
1337362
@Pure
	public static URL removeExtension(URL filename) {
		if (filename == null) {
			return null;
		}
		final String path = filename.getPath().replaceFirst(Pattern.quote(URL_PATH_SEPARATOR)
				+ "+$", ""); //$NON-NLS-1$ //$NON-NLS-2$
		int idx = path.lastIndexOf(URL_PATH_SEPARATOR);
		final StringBuilder buf = new StringBuilder((idx < 0) ? "" : //$NON-NLS-1$
				decodeHTMLEntities(path.substring(0, idx + 1)));
		final String largeBasename = decodeHTMLEntities(path.substring(idx + 1));
		idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
		if (idx < 0) {
			return filename;
		}
		buf.append(largeBasename.substring(0, idx));
		try {
			if (isJarURL(filename)) {
				return new URL(
						filename.getProtocol(),
						filename.getHost(),
						filename.getPort(),
						buf.toString());
			}
			return new URI(
					filename.getProtocol(),
					filename.getUserInfo(),
					filename.getHost(),
					filename.getPort(),
					buf.toString(),
					decodeHTMLEntities(filename.getQuery()),
					filename.getRef()).toURL();
		} catch (AssertionError e) {
			throw e;
		} catch (Throwable exception) {
			//
		}
		try {
			return new URL(
					filename.getProtocol(),
					filename.getHost(),
					buf.toString());
		} catch (AssertionError e) {
			throw e;
		} catch (Throwable exception) {
			return null;
		}
	}
752665
static String stripMappingPath(String url, UriMapping mapping) {
        String relativeUrl = url;
        // Uri mapping
        String mappingPath;
        if (mapping == null) {
            mappingPath = null;
        } else {
            mappingPath = mapping.getPath();
        }

        // Remove mapping path
        if (mappingPath != null && url.startsWith(mappingPath)) {
            relativeUrl = relativeUrl.substring(mappingPath.length());
        }
        return relativeUrl;
    }
1264470
public void removeKey(String key) {
        if (key != null && !key.isEmpty()) {
            for (int i=0; i<map.size(); i++) {
                KeyValue kv = map.get(i);
                if (key.equals(kv.getKey())) {
                    map.remove(i);
                    return;
                }
            }
        }
    }
580516
public static String getUrl(final String url) throws Exception {
        return getUrl(new URL(url), null, null);
    }
837785
protected void addURL(final URL url) {
    final URL[] newUrls = new URL[this.urls.length + 1];
    System.arraycopy(url, 0, newUrls, 0, this.urls.length);
    newUrls[this.urls.length] = url;
    this.urls = newUrls;
  }
1090504
public OkRequest<T> param(final String key, final String value) {
        StringBuilder urlBuilder = new StringBuilder(getUrl());
        if (getUrl().contains("?")) {
            urlBuilder.append("&");
        } else {
            urlBuilder.append("?");
        }
        urlBuilder.append(key);
        urlBuilder.append("=");
        urlBuilder.append(value);
        mRequestUrl = urlBuilder.toString();
        return this;
    }
399084
public static Response delete(String url) throws HttpException {

		return delete(url, null, null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
	}
1018939
@Override
	public Object remove(java.lang.Object key) {
		return internalMap.remove(key);
	}
634455
@Override
    public Object remove(Object key) {
        int scope = context.getAttributesScope((String) key);
        if (scope > -1)
            return context.removeAttribute((String) key, scope);
        return null;
    }
468768
public String delete(String url) throws AuthenticationException, ApiException {
		return performRequest(url, "DELETE", null, null, null);
	}
1092189
public PurgeResponse purge(String url) {
        return purge(new PurgeRequest().addTask(new PurgeTask().withUrl(url)));
    }
430059
public Map<String, String> removeRequestHeader(String key) {
    this.requestHeaders.remove(key);
    return getRequestHeaders();
  }
761802
public String get(String key) {
		addToDefaults(key, null);
		unrequestedParameters.remove(key);
		return data.get(key);
	}
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;
    }
}
649
public final void remove(final String key) {
        final Property prop = find(key);
        if (prop != null) {
            prop.setValue(null);
        }
    }