转换字符串格式,可用于sql in
/// <summary> /// 转换字符串格式,可用于sql in /// </summary> /// <param name="lst"></param> /// <returns></returns> public static string ParseToSQLIn(string lst) { StringBuilder sb = new StringBuilder(); string[] array = lst.Split(','); //sb.Append("'0'"); foreach (string item in array) { sb.Append(",'"); sb.Append(item); sb.Append("'"); } if (sb.Length > 0) { sb.Remove(0, 1); } return sb.ToString(); }