@Test public void testRemoveParameterWhenSuffixMatch() throws Exception { assertThat(QueryUtil.removeParameter("name2", "name1=value1&myname2=value2"), is("name1=value1&myname2=value2")); }
public static String removeParameter(String param, String query) { String token = param + "="; int i = query.indexOf(token); while (i > 0 && query.charAt(i - 1) != '&') { i = query.indexOf(token, i + 1); } if (i == -1) return query; int j = query.indexOf('&', i); if (j == -1) { return query.substring(0, i == 0 ? i : i - 1); } return query.substring(0, i) + query.substring(j + 1); }
QueryUtil { public static String removeParameter(String param, String query) { String token = param + "="; int i = query.indexOf(token); while (i > 0 && query.charAt(i - 1) != '&') { i = query.indexOf(token, i + 1); } if (i == -1) return query; int j = query.indexOf('&', i); if (j == -1) { return query.substring(0, i == 0 ? i : i - 1); } return query.substring(0, i) + query.substring(j + 1); } }
QueryUtil { public static String removeParameter(String param, String query) { String token = param + "="; int i = query.indexOf(token); while (i > 0 && query.charAt(i - 1) != '&') { i = query.indexOf(token, i + 1); } if (i == -1) return query; int j = query.indexOf('&', i); if (j == -1) { return query.substring(0, i == 0 ? i : i - 1); } return query.substring(0, i) + query.substring(j + 1); }  }
QueryUtil { public static String removeParameter(String param, String query) { String token = param + "="; int i = query.indexOf(token); while (i > 0 && query.charAt(i - 1) != '&') { i = query.indexOf(token, i + 1); } if (i == -1) return query; int j = query.indexOf('&', i); if (j == -1) { return query.substring(0, i == 0 ? i : i - 1); } return query.substring(0, i) + query.substring(j + 1); }  static String removeProtocolParameters(
      AuthenticationProtocol protocol, String query); static String removeEachParameter(String param, String query); static String removeParameter(String param, String query); static String findParameter(String param, String query); }
QueryUtil { public static String removeParameter(String param, String query) { String token = param + "="; int i = query.indexOf(token); while (i > 0 && query.charAt(i - 1) != '&') { i = query.indexOf(token, i + 1); } if (i == -1) return query; int j = query.indexOf('&', i); if (j == -1) { return query.substring(0, i == 0 ? i : i - 1); } return query.substring(0, i) + query.substring(j + 1); }  static String removeProtocolParameters(
      AuthenticationProtocol protocol, String query); static String removeEachParameter(String param, String query); static String removeParameter(String param, String query); static String findParameter(String param, String query);  }