把一个数组分解成两个数组
程序员文章站
2022-03-10 12:09:42
...
String[] ids ={"01-aa","02-bb","03-cc","04-dd","05-ee"};
String[] m = new String[ids.length];
String[] n = new String[ids.length];
for(int i=0;i<ids.length;i++){
m[i] = ids[i].split("-")[0];
n[i] = ids[i].split("-")[1];
}
System.out.println(Arrays.toString(m));
System.out.println(Arrays.toString(n));