String型 数组

2024-12-31 13:47:51
推荐回答(3个)
回答1:

太简单了 用一个split()方法
String s = "65,45,5,145,8,5,6";
String[] str = s.split(",");
这样就行了

回答2:

String[] strArray = "65,45,5,145,8,5,6, ".split(",");

回答3:

Code:
public static void main(String[] args) {
String[] str = "65,45,5,145,8,5,6, ".split(",");
for (int i=0;i System.out.println(str[i]);
}
}

Output:
run:
65
45
5
145
8
5
6