62,615
社区成员
发帖
与我相关
我的任务
分享
public class Test {
public static void main(String[] args) {
System.out.println(s("absfyughsfhg","sf"));
}
public static List<Integer> s(String str, String s) {
List<Integer> position = new ArrayList<Integer>();
for(int i=0;i<str.length();i++) {
int y = str.indexOf(s,i);
if(-1 == y) {
break;
}else {
position.add(y);
i+=y;
}
}
return position;
}
}