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

/**
 * Combines the given array of Objects into a single String using
 * each Object's toString() method and the separator character
 * between each part.//ww w.  j a  v a2s  .  co  m
 *
 * @param parts
 * @param separator
 * @return new String
 */
public static String combine(Object[] parts, char separator) {
    if (parts == null) {
        return null;
    }
    return TextUtils.join(String.valueOf(separator), parts);
}

From source file:it.polimi.spf.framework.proximity.FieldContainerMarshaller.java

public static String marshallIdentifierList(String[] list) {
    return TextUtils.join(SEPARATOR, list);
}

From source file:Main.java

/**
 *
 * @param scopes array to return as space delimited
 * @return space-delimited {@link String} of Scopes and Custom Scopes
 *///from  w ww  . ja  va 2 s . com
public static String mergeScopeStrings(String... scopes) {
    return TextUtils.join(" ", scopes).trim();
}

From source file:co.rewen.statex.AsyncLocalStorageUtil.java

/**
 * Build the String required for an SQL select statement:
 *  WHERE key IN (?, ?, ..., ?)/*from  w w  w . j  a  va 2  s .co  m*/
 * without 'WHERE' and with selectionCount '?'
 */
/* package */
static String buildKeySelection(int selectionCount) {
    String[] list = new String[selectionCount];
    Arrays.fill(list, "?");
    return KEY_COLUMN + " IN (" + TextUtils.join(", ", list) + ")";
}

From source file:Main.java

@SuppressLint("InlinedApi")
public static String getSourceClassesString(int sources) {
    List<String> names = new ArrayList<String>();
    addString(sources, InputDevice.SOURCE_CLASS_BUTTON, names);
    addString(sources, InputDevice.SOURCE_CLASS_POINTER, names);
    addString(sources, InputDevice.SOURCE_CLASS_TRACKBALL, names);
    addString(sources, InputDevice.SOURCE_CLASS_POSITION, names);
    addString(sources, InputDevice.SOURCE_CLASS_JOYSTICK, names);
    return TextUtils.join(", ", names);
}

From source file:Main.java

/**
 * Converts a {@link Collection} of {@link String}s into a space-delimited {@link String}.
 *
 * @param scopes the {@link Collection} of {@link String}s to convert
 * @return a space-delimited {@link String} of {@link Scope}s
 *///w  w  w.j a v  a  2  s  . c  o  m
public static String customScopeCollectionToString(@NonNull Collection<String> scopes) {
    return TextUtils.join(" ", scopes).toLowerCase();
}

From source file:Main.java

@SuppressLint("InlinedApi")
public static String getSourcesString(int sources) {
    List<String> names = new ArrayList<String>();
    addString(sources, InputDevice.SOURCE_KEYBOARD, names);
    addString(sources, InputDevice.SOURCE_DPAD, names);
    addString(sources, InputDevice.SOURCE_GAMEPAD, names);
    addString(sources, InputDevice.SOURCE_TOUCHSCREEN, names);
    addString(sources, InputDevice.SOURCE_MOUSE, names);
    addString(sources, InputDevice.SOURCE_STYLUS, names);
    addString(sources, InputDevice.SOURCE_TOUCHPAD, names);
    addString(sources, InputDevice.SOURCE_JOYSTICK, names);
    return TextUtils.join(", ", names);
}

From source file:Main.java

/**
 * join list to string. if separator is null, use {@link #DEFAULT_JOIN_SEPARATOR}
 * <p/>/*from  w ww. j  a  v a  2s .  co  m*/
 * <pre>
 * join(null, "#")     =   "";
 * join({}, "#$")      =   "";
 * join({a,b,c}, null) =   "a,b,c";
 * join({a,b,c}, "")   =   "abc";
 * join({a,b,c}, "#")  =   "a#b#c";
 * join({a,b,c}, "#$") =   "a#$b#$c";
 * </pre>
 *
 * @param list
 * @param separator
 * @return join list to string with separator. if list is empty, return ""
 */
public static String join(List<String> list, String separator) {
    return list == null ? "" : TextUtils.join(separator, list);
}

From source file:edu.mit.mobile.android.locast.data.tags.TaggableUtils.java

public static Uri getItemMatchingTags(Uri contentDir, String... tag) {

    return contentDir.buildUpon().appendQueryParameter(QUERY_PARAMETER_TAGS, TextUtils.join(",", tag)).build();
}

From source file:Main.java

/**
 * join list to string. if separator is null, use {@link #DEFAULT_JOIN_SEPARATOR}
 * <p/>/*  www.  j a va  2  s  .com*/
 * <pre>
 * join(null, "#")     =   "";
 * join({}, "#$")      =   "";
 * join({a,b,c}, null) =   "a,b,c";
 * join({a,b,c}, "")   =   "abc";
 * join({a,b,c}, "#")  =   "a#b#c";
 * join({a,b,c}, "#$") =   "a#$b#$c";
 * </pre>
 *
 * @param collection
 * @param separator
 * @return join list to string with separator. if list is empty, return ""
 */
public static String join(Iterable collection, CharSequence separator) {
    return collection == null ? "" : TextUtils.join(separator, collection);
}