MOD:支持加载其他目录索引
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
package com.leosam.tvbox.mv.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @since 2023/6/12 21:32
|
||||
*/
|
||||
public class StringUtils {
|
||||
|
||||
public static final String EMPTY = "";
|
||||
|
||||
public static boolean isNotEmpty(final CharSequence cs) {
|
||||
return !isEmpty(cs);
|
||||
}
|
||||
@@ -13,4 +18,30 @@ public class StringUtils {
|
||||
public static boolean isEmpty(final CharSequence cs) {
|
||||
return cs == null || cs.length() == 0;
|
||||
}
|
||||
|
||||
public static String defaultIfEmpty(final String str, String defaultStr) {
|
||||
return isNotEmpty(str) ? str : defaultStr;
|
||||
}
|
||||
|
||||
public static String trimToEmpty(final String str) {
|
||||
return str == null ? EMPTY : str.trim();
|
||||
}
|
||||
|
||||
public static List<String> reverseSplit(String s, String delimiter, int limit) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if (s == null || delimiter == null || limit <= 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int lastIndex = s.lastIndexOf(delimiter);
|
||||
while (limit > 1 && lastIndex != -1) {
|
||||
result.add(0, s.substring(lastIndex + delimiter.length()));
|
||||
s = s.substring(0, lastIndex);
|
||||
lastIndex = s.lastIndexOf(delimiter);
|
||||
limit--;
|
||||
}
|
||||
result.add(0, s);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user