All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyuncs.utils.StringUtils Maven / Gradle / Ivy

package com.aliyuncs.utils;

public class StringUtils {

    public static boolean isEmpty(final CharSequence cs) {
        return cs == null || cs.length() == 0;
    }

    public static String join(String delimiter, Iterable elements) {
        if (isEmpty(delimiter) || elements == null) {
            return "";
        }
        StringBuilder stringBuilder = new StringBuilder();
        for (String value : elements) {
            stringBuilder.append(value);
            stringBuilder.append(delimiter);
        }
        if (stringBuilder.length() > 0) {
            stringBuilder.deleteCharAt(stringBuilder.length() - 1);
        }
        return stringBuilder.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy