java学习笔记之——StringUtils.join()
commons.lang3.StringUtils
StringUtils.join(Object array[],String separator)
将数组以符号或其他字符串为间隔组成新的字符串
Object array[] 需要转换的数组。separator组成新串的间隔符号,如 "," "|"
1 private static final String[] str = {"1","2","3","4"};
2 String str2 = StringUtils.join(str, "|");
3
4 System.out.println(str2);
输出结果:1|2|3|4