添加Url参数

2015-12-05 09:35:22  访问(1356) 赞(0) 踩(0)

 /// <summary>
        /// 添加参数
        /// </summary>
        /// <param name="url"></param>
        /// <param name="theParam"></param>
        /// <returns></returns>
        public static string UrlAddParam(string url, string theParam)
        {
            if (theParam == null || theParam.Length == 0)
                return url;

            if (url == null || url.Length == 0)
                return "?" + theParam;

            int idx = url.LastIndexOf('?');

            if (idx == -1)
                return url + "?" + theParam;
            else
                return url + "&" + theParam;
        }


标签:添加Url参数 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)