package cn.estsh.i3plus.ext.mes.pcn.pojo.util;


import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/**
 * @Description :OverwriteStringJoin
 * @Reference :
 * @Author : gsz
 * @CreateDate : 2024-05-10 16:08
 * @Modify:
 **/
public class OverwriteStringJoin {

    public static String join(CharSequence delimiter, CharSequence... elements) {
        Objects.requireNonNull(delimiter);
        Objects.requireNonNull(elements);
        StringJoiner joiner = new StringJoiner(delimiter);
        for (CharSequence cs: elements) {
            joiner.add("'" + cs + "'");
        }
        return joiner.toString();
    }
    public static String join(CharSequence delimiter, Collection<String> elements) {
        Objects.requireNonNull(delimiter);
        Objects.requireNonNull(elements);
        StringJoiner joiner = new StringJoiner(delimiter);
        for (String cs: elements) {
            joiner.add("'" + cs + "'");
        }
        return joiner.toString();
    }

}
