mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-05 00:45:06 -05:00
c93377010c
* just print help if started with no arguments in headless mode instead of crashing when trying to start the GUI
53 lines
1019 B
Java
53 lines
1019 B
Java
|
|
package net.sourceforge.tuned;
|
|
|
|
|
|
import static java.util.Arrays.*;
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
public final class StringUtilities {
|
|
|
|
public static boolean isEmptyValue(Object object) {
|
|
return object == null || object.toString().length() == 0;
|
|
}
|
|
|
|
|
|
public static String joinBy(CharSequence delimiter, Object... values) {
|
|
return join(asList(values), delimiter);
|
|
}
|
|
|
|
|
|
public static String join(Object[] values, CharSequence delimiter) {
|
|
return join(asList(values), delimiter);
|
|
}
|
|
|
|
|
|
public static String join(Iterable<?> values, CharSequence delimiter) {
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
for (Iterator<?> iterator = values.iterator(); iterator.hasNext();) {
|
|
Object value = iterator.next();
|
|
if (!isEmptyValue(value)) {
|
|
if (sb.length() > 0) {
|
|
sb.append(delimiter);
|
|
}
|
|
|
|
sb.append(value);
|
|
}
|
|
}
|
|
|
|
return sb.toString();
|
|
}
|
|
|
|
|
|
/**
|
|
* Dummy constructor to prevent instantiation.
|
|
*/
|
|
private StringUtilities() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
}
|