- public class Practice {
- public static void main(String[] args) {
- ArrayList<String[]> arr = new ArrayList<String[]>();
- String s = "boo:and:foo";
- int count = 0;
- String[] str = s.split("o");
- for (String string : str) {
- System.out.println(string);
- if (string.equals("")) {
- count++;
- }
- }
- System.out.println("打印"+(count++)+"次空格");
复制代码
|
|