要查找某个指定的字符在字符串中出现的位置,方法比较简单,使用 len() 函数和 replace() 函数结合就可以. SELECT TOP 200 approveInfo approveInfo2, LEN(approveInfo)-LEN(REPLACE(approveInfo,';','')) AS appLen, * FROM dbo.Log_Year WHERE ISNULL(approveInfo,'')<>'' ORDER BY appLen DESC 原理:字符串的长度 减去
Qualys项目中写到将ServerIP以“,”分割后插入数据库并将重复的IP去除后发送到服务器进行Scan,于是我写了下面的一段用来剔除重复IP: //CR#1796870 modify by v-yangwu, remove the IPs which are repeated. string[] arrayIP = ipAll.Split(','); List<string> listIP = new List<string>(); foreach (string ip in
本文基于Stackoverflows上以下几个Question: Fastest way to remove chars from string (http://stackoverflow.com/questions/2182459/fastest-way-to-remove-chars-from-string) More efficient way to remove special characters from string (http://stackoverflow.com/questi