Notice
Recent Posts
Recent Comments
반응형
목록2015/02/28 (1)
오늘도 공부
java로 implode 구현하기
public static String implode(String separator, String... data) { StringBuilder sb = new StringBuilder(); for (int i = 0; i to not add separator at the end if (!data[i].matches(" *")) {//empty string are ""; " "; " "; and so on sb.append(data[i]); sb.append(separator); } } sb.append(data[data.length - 1].trim()); return sb.toString(); }You can use it likeSystem.out.println(implode(", ", "ab", " "..
자바/자바팁
2015. 2. 28. 23:58
