怎么读取出address中的AB为新的String?
public static void main(String[] args) {
2 List<String> list = new ArrayList<String>();
3 list.add("AB");
4 list.add("BC");
5 list.add("CD");
6
7 String address="ABD";
8
9 }
怎么读取出address中的AB为新的String?
public static void main(String[] args) {
2 List<String> list = new ArrayList<String>();
3 list.add("AB");
4 list.add("BC");
5 list.add("CD");
6
7 String address="ABD";
8
9 }
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
list.add("AB");
list.add("BC");
list.add("CD");
String address="ABD";
for(String s:list){
if (address.contains(s)){
System.out.println(s);
}
}