mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add null check
This commit is contained in:
parent
e52aa5183a
commit
c07a7657ff
@ -16,6 +16,8 @@
|
||||
|
||||
package org.dromara.hutool.core.text.replacer;
|
||||
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
@ -46,6 +48,9 @@ public abstract class StrReplacer implements UnaryOperator<CharSequence>, Serial
|
||||
*/
|
||||
@Override
|
||||
public CharSequence apply(final CharSequence str) {
|
||||
if(StrUtil.isEmpty(str)){
|
||||
return str;
|
||||
}
|
||||
final int len = str.length();
|
||||
final StringBuilder builder = new StringBuilder(len);
|
||||
int pos = 0;//当前位置
|
||||
|
Loading…
x
Reference in New Issue
Block a user