package com.string;
public class Array {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s = "1,2;3,4,5;6,7,8";
String[] str = s.split(";");
String[][] str2 = new String[str.length][];
double a[][] = new double[str2.length][];
for(int i=0; i<str.length; i++) {
str2[i] = str[i].split(",");
}
for(int i=0; i<a.length; i++) {
a[i] = new double[str2[i].length];
for(int j =0; j<a[i].length; j++) {
//a[i][j] = Integer.parseInt(str2[i][j]);
//System.out.print(a[i][j] + ' ');
a[i][j] = Double.parseDouble(str2[i][j]);
System.out.println(a[i][j] + ' ');
}
System.out.println();
}
}
}
慕粉4065503
相关分类