附上.net/c#的解决办法:
c# 解决办法:
- /// <summary>
- /// 中去除指定参数
- /// </summary>
- /// <param name="url">地址</param>
- /// <param name="param">参数</param>
- /// <returns></returns>
- public static string buildurl(string url, string param)
- {
- string url1 = url;
- if (url.IndexOf(param, StringComparison.CurrentCultureIgnoreCase) > 0)
- {
- if (url.IndexOf("&", url.IndexOf(param, StringComparison.CurrentCultureIgnoreCase) + param.Length) > 0)
- {
- string temp1 = url.Substring(0, url.IndexOf(param, StringComparison.CurrentCultureIgnoreCase) - 1);
- string temp2 = url.Substring(url.IndexOf("&", url.IndexOf(param, StringComparison.CurrentCultureIgnoreCase) + param.Length) + 1);
- url1 = temp1 + "?" + temp2;
- }
- else
- {
- url1 = url.Substring(0, url.IndexOf(param, StringComparison.CurrentCultureIgnoreCase) - 1);
- }
- return url1;
- }
- else
- {
- return url1;
- }
- }
复制代码 url = buildurl(url, "visitDstTime");
|