update 拆分时 getChinese改用正则表达式判断中文
This commit is contained in:
+4
-2
@@ -1229,14 +1229,16 @@ public class FileSpiltService {
|
||||
sarFileSplitItemsValEO.setItemContent(itemContent);
|
||||
return sarFileSplitItemsValEO;
|
||||
}
|
||||
private static final Pattern CHINESE_PATTERN = Pattern.compile("[\u4e00-\u9fa5]");
|
||||
|
||||
public String getChinese(String source) {
|
||||
|
||||
char[] chars = source.toCharArray();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (char aChar : chars) {
|
||||
int length = String.valueOf(aChar).getBytes().length;
|
||||
if (length == 3 && aChar != 8195) {
|
||||
String s = String.valueOf(aChar);
|
||||
Matcher matcher = CHINESE_PATTERN.matcher(s);
|
||||
if (matcher.find()) {
|
||||
stringBuilder.append(aChar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.jero.modules.split.util;
|
||||
|
||||
import com.aspose.words.*;
|
||||
import com.jero.modules.split.vo.TitleNumberVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.poi.xwpf.usermodel.VerticalAlign;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -14,6 +17,7 @@ import java.util.Map;
|
||||
* @author liJiaRao
|
||||
* @date 2023-09-20 14:42
|
||||
*/
|
||||
@Slf4j
|
||||
public class AsposeUtil {
|
||||
/**
|
||||
* 获得序号标题和无标题序号
|
||||
@@ -57,7 +61,6 @@ public class AsposeUtil {
|
||||
labelString = labelString.replaceAll("\t", "").replaceAll("\b", "")
|
||||
.replaceAll(" ", "").replaceAll("\"", "").replaceAll("'", "").replaceAll(" ", "");
|
||||
|
||||
System.out.println("Text:" + labelString + text);
|
||||
if (StringUtils.isNotBlank(text)) {
|
||||
if (titleNumberMap.containsKey(text)) {
|
||||
List<String> strings = titleNumberMap.get(text);
|
||||
|
||||
Reference in New Issue
Block a user