我们都知道java中有封装好的方法,用来比较A字符串是否包含B字符串 如下代码,contains,用法是 str1.contains(str2), 这个布尔型返回,存在返回true,不存在返回false 还有indexOf,用法和contains一致,返回值是int,存在则返回对应的位置,注意位置从0开始的,不存在返回-1 public class Test { public static void main(String[] args) { String source = "abacaabac
如果想从SQL Server中查询包含某个关键字的东东,怎么查询呢? 一般有两个方法: 1.用like——select * from tablename where field1 like like ‘%key%’ 这种方法可以查一个句子里面包含什么词儿啥的. 2.用charindex()——charindex(字符,字符串)>0 –>包含