| | |
| | | import java.security.NoSuchAlgorithmException;
|
| | | import java.util.List;
|
| | |
|
| | |
|
| | | public class StringUtils {
|
| | | |
| | |
|
| | | public static boolean isEmpty(String value) {
|
| | | return value == null || value.trim().length() == 0;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static String flattenStrings(List<String> values) {
|
| | | return flattenStrings(values, " ");
|
| | | }
|
| | |
|
| | | public static String flattenStrings(List<String> values, String separator) {
|
| | | StringBuilder sb = new StringBuilder();
|
| | | for (String value : values) {
|
| | | sb.append(value).append(" ");
|
| | | sb.append(value).append(separator);
|
| | | }
|
| | | return sb.toString().trim();
|
| | | }
|
| | |
| | | throw new RuntimeException(t);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | public static String getRootPath(String path) {
|
| | | if (path.indexOf('/') > -1) {
|
| | | return path.substring(0, path.indexOf('/'));
|
| | | }
|
| | | return "";
|
| | | }
|
| | | }
|