[Java] String split 字串分割
String temp = "data1, data2, data3, data4"; //欲分割的字串
String data[] = temp.split(","); //分割後存進字串陣列
//印出每一個陣列元素
for(String result:data){
System.out.println(result);
}
String temp = "data1, data2, data3, data4"; //欲分割的字串
String data[] = temp.split(","); //分割後存進字串陣列
//印出每一個陣列元素
for(String result:data){
System.out.println(result);
}