java 中根据指定元素分割String字符串

public  static  void  main(String[] args){
        String str="护肤,药品,其他";
        String temp[];
        temp=str.split(",");
        for (String s : temp) {
            System.out.println("s: "+s);
        }

    }

将 str中的字符按照“,”分割

posted @ 2019-07-17 21:28  Angry-rookie  阅读(6793)  评论(0编辑  收藏  举报