用java将”one, two, there, four”以逗号分割的字符串分解,怎么弄?

2025-03-24 02:58:39
推荐回答(2个)
回答1:

代码如下:

String s = "one, two, there, four";
  String[] as = s.split(", ");
  for (int i = 0; i < as.length; i++) {
   System.out.println(as[i]);
  }

回答2:

String s = "one, two, there, four";
String[] as = s.split(", ");
for (int i = 0; i < as.length; i++) {
System.out.println(as[i]);
}