Join List<String> to String - Android java.util

Android examples for java.util:List

Description

Join List<String> to String

Demo Code

import java.util.List;
public class Main{

    public static String Join(List<String> list, String split) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            sb.append(list.get(i));/* w  ww.  j a  v  a 2s.c o  m*/
            if (i + 1 != list.size()) {
                sb.append(split);
            }
        }
        return sb.toString();
    }

}

Related Tutorials