字符串处理总结

StringJoiner

public static void main(String[] args) {
    //值依次是分割符,前缀,后缀
    StringJoiner joiner = new StringJoiner(",","[","]");
    joiner.add("张三").add("李四");
    //结果:[张三,李四]
    System.out.println(joiner);
}

 

posted @ 2021-02-20 14:32  夏夜凉凉  阅读(34)  评论(0编辑  收藏  举报