Example usage for android.text TextUtils join

List of usage examples for android.text TextUtils join

Introduction

In this page you can find the example usage for android.text TextUtils join.

Prototype

public static String join(@NonNull CharSequence delimiter, @NonNull Iterable tokens) 

Source Link

Document

Returns a string containing the tokens joined by delimiters.

Usage

From source file:Main.java

public static String getOccupantsIdsStringFromList(Collection<Integer> occupantIdsList) {
    return TextUtils.join(",", occupantIdsList);
}

From source file:Main.java

public static <T> String ArrayAsString(final T[] array) {
    StringBuilder sb = new StringBuilder();
    sb.append("[").append(TextUtils.join(",", array)).append("]");
    return sb.toString();
}

From source file:Main.java

public static String getOccupantsIdsStringFromList(List<Integer> occupantIdsList) {
    return TextUtils.join(OCCUPANT_IDS_DIVIDER, occupantIdsList);
}

From source file:Main.java

public static boolean sameStringLists(List<String> list1, List<String> list2) {
    if (list1.size() != list2.size())
        return false;
    return TextUtils.join(",", list1).equals(TextUtils.join(",", list2));
}

From source file:Main.java

/**
 * Joins an array of objects with a separator into a String
 *
 * @param separator the separator//from  ww  w  . jav a  2 s .  c  om
 * @param args      the args
 * @return the joined string
 */
public static String join(CharSequence separator, Object... args) {
    return TextUtils.join(separator, args);
}

From source file:Main.java

public static <T> String ListArrayAsString(final List<T[]> lstStringArray) {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    for (T[] sArr : lstStringArray) {
        sb.append("[").append(TextUtils.join(",", sArr)).append("]");
    }//w w w.ja va2s  .c o  m
    sb.append("}");
    return sb.toString();
}

From source file:Main.java

/**
 * join collection to string, separator is {@link #DEFAULT_JOIN_SEPARATOR}
 * //from w ww  .  j  a va  2s .  c om
 * <pre>
 * join(null)      =   "";
 * join({})        =   "";
 * join({a,b})     =   "a,b";
 * </pre>
 * 
 * @param collection
 * @return join collection to string, separator is {@link #DEFAULT_JOIN_SEPARATOR}. if collection is empty, return
 *         ""
 */
public static String join(Iterable collection) {
    return collection == null ? "" : TextUtils.join(DEFAULT_JOIN_SEPARATOR, collection);
}

From source file:Main.java

public static String joinSlash(List<String> sequence) {
    if (sequence != null && sequence.size() > 0) {
        return TextUtils.join("/", sequence);
    }/*from  ww w  .java  2  s  .  com*/
    return "";
}

From source file:Main.java

/**
 * Join collection to string, separator is {@link #DELIMITER}
 *
 * @param tokens//  w  ww . ja v a2s . com
 * @return
 */
public static String join(Iterable tokens) {
    return tokens == null ? "" : TextUtils.join(DELIMITER, tokens);
}

From source file:Main.java

public static ComponentName getDefaultViewerComponentName(Context context, String fullPath, String mimeType) {
    String viewer = PreferenceManager.getDefaultSharedPreferences(context)
            .getString(DEFAULT_VIEWER_PREFIX + fullPath, null);
    if (viewer == null) {
        viewer = PreferenceManager.getDefaultSharedPreferences(context)
                .getString(DEFAULT_VIEWER_PREFIX + mimeType, null);
    }/*from  w  w w. j a v  a  2 s .com*/

    if (viewer != null) {
        String[] comps = viewer.split("\t");
        if (comps.length == 2) {
            return new ComponentName(comps[0], comps[1]);
        }
        throw new IllegalArgumentException("Unable to decode " + TextUtils.join(" ", comps));
    }
    return null;
}