分割字符串并按照预想格式合并
作者:互联网
public static string FormatSearchFieldOfMutiValue(string vSearchValue) { var rtn = ""; vSearchValue = vSearchValue.Trim(); vSearchValue = vSearchValue.Replace("'", "''"); var array = vSearchValue.Split(new char[] { ',', ',', ';', ';', '+', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length > 0) { rtn = "'" + string.Join("','", array.Where(n => n != "")) + "'"; } else { rtn = "''"; } return rtn; }
标签:string,rtn,vSearchValue,char,var,字符串,格式,array,预想 来源: https://www.cnblogs.com/LittleBai/p/12786313.html