public static int repeatedStringMatch(String A, String B) { //判断字符串a重复几次可以包含另外一个字符串b,就是不断叠加字符串a直到长度大于等于b,叠加一次计数+1 //看现在的字符串是否包含b,包含就返回,不会包含就再叠加一次,因为可能有半截的在后边,再判断,再没有就返回-1 int count = 0; StringBuilder sb = new StringBuilder(); while (sb.length() < B.l
_.ok:=interface{}(a).(B) 此语句用于判断对象a是否是B类型 也可以判断对象a是否实现了B接口 package main import "fmt" type Pet interface { SetName(name string) Name()string Category()string } type Dog struct { name string } func (dog *Dog) SetName(name string) { dog.name = name
Set<User> userSet = new HashSet<>(); User user1= new User("aa","11"); User user2= new User("aa","11"); userSet.add(user1); userSet.add(user2); System.out.println("set size"+userSet.size()); Ite
最近发布的脚本,有那种防止重复插入数据(包括存在时更新,不存在是插入的处理,判断的方向可能与下面的示例相反) 使用类似下面的 SQL declare @id int, @value int if not exists( select * from tb where id = @id ) insert tb values( @id, @value ); --else -- update tb set value = @value where id = @id; 或者是使用这种单句的 declar