/// <summary> /// 获得规范的strArray 1,2,3,4 /// </summary> /// <param name="str"></param> /// <returns></returns> public static string GetStrArray(string str) { var result = string.Empty; if (string.IsNullOrEmpty(str)) { result = string.Empty; } else { foreach (Match m in RegexCore.Matches(str, @"(?<content>(\d+,?)+)")) { var tempStr = m.Groups["content"].Value; if (!string.IsNullOrEmpty(tempStr)) { tempStr.Split(',').All(id => { if (id.Length > 0) { result += id + ","; } return(true); }); } } result = RegexCore.Replace(result, ",$", ""); } return(result); }
public static string UrlDecode(string s, bool filterHtml) { if (filterHtml) { return(RegexCore.ReplaceHtml("", UrlDecode(s), "")); } else { return(UrlDecode(s)); } }
/// <summary> /// 将int 的集合转化成 类似“1,2,3,4”这样的格式 /// </summary> /// <returns></returns> public static string ConvertListToStr(List <int> ids) { var result = string.Empty; ids.All(id => { result += id.ToString() + ","; return(true); }); result = RegexCore.Replace(result, ",$", ""); return(result); }