如何判断字段A里边包括字段B??
打个比方 |1|2|3|里包括|3|
------解决方案--------------------------------------------------------
indexof
------解决方案--------------------------------------------------------
- C# code
string s = "123"; if (s.Contains("3") == true) { //包含3 } else { //不包含3 }
------解决方案--------------------------------------------------------
string str="¦1 ¦2 ¦3";
int i = str.indexof("¦3");
if(i>0)
{
//存在
}
else
{
//不存在
}
感觉 这个效率还行吧。
------解决方案--------------------------------------------------------
- C# code
string.Contain("3");string.IndexOf("3");System.Text.RegularExpressions.Regex.IsMatch(inputString, "*3*");
------解决方案--------------------------------------------------------
select *,case when charindex(b,a)>0 then 1 else 0 end from tb