mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 13:34:09 +08:00
fix code
This commit is contained in:
parent
52afcdd388
commit
a7663b93f7
@ -0,0 +1,7 @@
|
|||||||
|
package cn.hutool.v7.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hutool主类
|
||||||
|
*/
|
||||||
|
public class HutoolCore {
|
||||||
|
}
|
@ -18,6 +18,7 @@ package cn.hutool.v7.core.text.replacer;
|
|||||||
|
|
||||||
import cn.hutool.v7.core.text.finder.MultiStrFinder;
|
import cn.hutool.v7.core.text.finder.MultiStrFinder;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,6 +33,7 @@ import java.util.*;
|
|||||||
* @author newshiJ
|
* @author newshiJ
|
||||||
*/
|
*/
|
||||||
public class HighMultiReplacerV2 extends StrReplacer {
|
public class HighMultiReplacerV2 extends StrReplacer {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final AhoCorasickAutomaton ahoCorasickAutomaton;
|
private final AhoCorasickAutomaton ahoCorasickAutomaton;
|
||||||
@ -79,7 +81,7 @@ public class HighMultiReplacerV2 extends StrReplacer {
|
|||||||
// 下一个字符在候选转换字符串中都不存在 ch字符一定不会被替换
|
// 下一个字符在候选转换字符串中都不存在 ch字符一定不会被替换
|
||||||
if(index == null || index < 0){
|
if(index == null || index < 0){
|
||||||
// 临时缓存空间中的数据写入到输出的 StringBuilder
|
// 临时缓存空间中的数据写入到输出的 StringBuilder
|
||||||
if(temp.length() > 0){
|
if(!temp.isEmpty()){
|
||||||
stringBuilder.append(temp);
|
stringBuilder.append(temp);
|
||||||
// 数据写入后清空临时空间
|
// 数据写入后清空临时空间
|
||||||
temp.delete(0, temp.length());
|
temp.delete(0, temp.length());
|
||||||
@ -96,7 +98,7 @@ public class HighMultiReplacerV2 extends StrReplacer {
|
|||||||
|
|
||||||
// 当前是root节点表示匹配中断 清理临时空间 写入到输出
|
// 当前是root节点表示匹配中断 清理临时空间 写入到输出
|
||||||
if(currentNode.nodeIndex == 0){
|
if(currentNode.nodeIndex == 0){
|
||||||
if(temp.length() > 0){
|
if(!temp.isEmpty()){
|
||||||
stringBuilder.append(temp);
|
stringBuilder.append(temp);
|
||||||
// 数据写入后清空临时空间
|
// 数据写入后清空临时空间
|
||||||
temp.delete(0, temp.length());
|
temp.delete(0, temp.length());
|
||||||
@ -111,7 +113,7 @@ public class HighMultiReplacerV2 extends StrReplacer {
|
|||||||
final int length = currentNode.tagetString.length() - 1;
|
final int length = currentNode.tagetString.length() - 1;
|
||||||
// 先清理匹配到的字符 最后一个字符未加入临时空间
|
// 先清理匹配到的字符 最后一个字符未加入临时空间
|
||||||
temp.delete(temp.length() - length,temp.length());
|
temp.delete(temp.length() - length,temp.length());
|
||||||
if(temp.length() > 0){
|
if(!temp.isEmpty()){
|
||||||
stringBuilder.append(temp);
|
stringBuilder.append(temp);
|
||||||
}
|
}
|
||||||
// 写入被替换的字符串
|
// 写入被替换的字符串
|
||||||
|
@ -23,7 +23,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cmm
|
* @author cmm
|
||||||
* @date 2024/8/12 14:49
|
|
||||||
*/
|
*/
|
||||||
public class HighMultiReplacerV2Test {
|
public class HighMultiReplacerV2Test {
|
||||||
@Test
|
@Test
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 由于Hutool的原则是不依赖于其它配置文件,但是很多时候我们需要针对第三方非常棒的库做一些工具类化的支持<br>
|
* 由于Hutool的原则是不依赖于其它配置文件,但是很多时候我们需要针对第三方非常棒的库做一些工具类化的支持<br>
|
||||||
* 因此Hutoo-extra包主要用于支持第三方库的工具类支持。
|
* 因此Hutool-extra包主要用于支持第三方库的工具类支持。
|
||||||
*
|
*
|
||||||
* @author Looly
|
* @author Looly
|
||||||
*/
|
*/
|
||||||
|
2
pom.xml
2
pom.xml
@ -207,6 +207,8 @@
|
|||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${compile.version}</source>
|
<source>${compile.version}</source>
|
||||||
|
<release>${compile.version}</release>
|
||||||
|
<failOnError>false</failOnError>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- 统一更新pom版本 -->
|
<!-- 统一更新pom版本 -->
|
||||||
|
Loading…
Reference in New Issue
Block a user