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

Back to posts


comments powered by Disqus