StrUtil增加toStringOrEmpty方法

This commit is contained in:
Looly 2024-04-03 12:45:08 +08:00
parent 562d41386f
commit 28222dd349
2 changed files with 4 additions and 3 deletions

View File

@ -2,10 +2,11 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.28(2024-04-01)
# 5.8.28(2024-04-03)
### 🐣新特性
* 【core 】 修正XmlUtil的omitXmlDeclaration描述注释issue#I9CPC7@Gitee
* 【core 】 StrUtil增加toStringOrEmpty方法issue#I9CPC7@Gitee
### 🐞Bug修复

View File

@ -294,9 +294,9 @@ public class StrUtil extends CharSequenceUtil implements StrPool {
* @return {@link String }
* @author ahwei163@qq.com
*/
public static String toStringOrEmptyStr(Object obj) {
public static String toStringOrEmpty(Object obj) {
// obj为空时, 返回 null "null" 都不适用部分场景, 此处返回 "" 空字符串
return null == obj ? "" : obj.toString();
return null == obj ? EMPTY : obj.toString();
}
/**