mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 01:28:34 +08:00
fix:字符串NPE
This commit is contained in:
parent
23b60cd9cc
commit
f3992c706d
@ -370,6 +370,9 @@ public class StrUtil extends CharSequenceUtil implements StrPool {
|
|||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static String reverse(String str) {
|
public static String reverse(String str) {
|
||||||
|
if (null == str) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new String(ArrayUtil.reverse(str.toCharArray()));
|
return new String(ArrayUtil.reverse(str.toCharArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,6 +417,9 @@ public class StrUtil extends CharSequenceUtil implements StrPool {
|
|||||||
* @since 3.1.2
|
* @since 3.1.2
|
||||||
*/
|
*/
|
||||||
public static String fill(String str, char filledChar, int len, boolean isPre) {
|
public static String fill(String str, char filledChar, int len, boolean isPre) {
|
||||||
|
if (null == str) {
|
||||||
|
str = "";
|
||||||
|
}
|
||||||
final int strLen = str.length();
|
final int strLen = str.length();
|
||||||
if (strLen > len) {
|
if (strLen > len) {
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user