优化Utility.aes
This commit is contained in:
@@ -506,6 +506,29 @@ public final class Utility {
|
||||
return str == null || str.isEmpty() || str.isBlank();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为空白
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param fromIndex 起始位置
|
||||
* @param toIndex 结束位置
|
||||
*
|
||||
* @return 是否为空白
|
||||
*
|
||||
*/
|
||||
public static boolean isBlank(String str, int fromIndex, int toIndex) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (int i = fromIndex; i < toIndex; i++) {
|
||||
char ch = str.charAt(i);
|
||||
if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否不为空白
|
||||
*
|
||||
@@ -518,6 +541,29 @@ public final class Utility {
|
||||
return str != null && !str.isEmpty() && !str.isBlank();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否不为空白
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param fromIndex 起始位置
|
||||
* @param toIndex 结束位置
|
||||
*
|
||||
* @return 是否为空白
|
||||
*
|
||||
*/
|
||||
public static boolean isNotBlank(String str, int fromIndex, int toIndex) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = fromIndex; i < toIndex; i++) {
|
||||
char ch = str.charAt(i);
|
||||
if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为空
|
||||
*
|
||||
|
||||
@@ -413,12 +413,12 @@ public class XmlReader {
|
||||
.replace(">", ">").replace("&", "&");
|
||||
}
|
||||
|
||||
protected RuntimeException newException(String msg) {
|
||||
protected RedkaleException newException(String msg) {
|
||||
return newException(msg, (Throwable) null);
|
||||
}
|
||||
|
||||
protected RuntimeException newException(String msg, Throwable chain) {
|
||||
return new RuntimeException((msg == null ? "" : (msg + " "))
|
||||
protected RedkaleException newException(String msg, Throwable chain) {
|
||||
return new RedkaleException((msg == null ? "" : (msg + " "))
|
||||
+ "(line: " + this.lineNumber + ", column: " + this.columnNumber + ", position:" + this.position + ") "
|
||||
+ (chain == null ? "" : ("caused by: " + chain)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user