Merge pull request #953 from echohlne/v5-dev

已经判断isEmpty(string)为true字符串为空时,直接复用全局的静态final EMPTY字段,而不需要调用toString方法
This commit is contained in:
Golden Looly
2020-07-06 11:00:06 +08:00
committed by GitHub

View File

@@ -1840,7 +1840,7 @@ public class StrUtil {
*/
public static String subBefore(CharSequence string, char separator, boolean isLastSeparator) {
if (isEmpty(string)) {
return null == string ? null : string.toString();
return null == string ? null : EMPTY;
}
final String str = string.toString();
@@ -1878,7 +1878,7 @@ public class StrUtil {
*/
public static String subAfter(CharSequence string, CharSequence separator, boolean isLastSeparator) {
if (isEmpty(string)) {
return null == string ? null : string.toString();
return null == string ? null : EMPTY;
}
if (separator == null) {
return EMPTY;
@@ -1914,7 +1914,7 @@ public class StrUtil {
*/
public static String subAfter(CharSequence string, char separator, boolean isLastSeparator) {
if (isEmpty(string)) {
return null == string ? null : string.toString();
return null == string ? null : EMPTY;
}
final String str = string.toString();
final int pos = isLastSeparator ? str.lastIndexOf(separator) : str.indexOf(separator);