update 文档拆分

This commit is contained in:
lijiarao
2024-07-15 18:18:23 +08:00
parent b47ff56c87
commit 8d6a4acf37
@@ -375,8 +375,8 @@ public class FileSpiltService {
startDigit = getOneStartDigit(paragraphString, enumByValue);
}
for (int i = 0; i < nowStart.size(); i++) {
// if (paragraphString.startsWith(nowStart.get(i))) {
if (startDigit.equals(nowStart.get(i))) {
if (startDigit.startsWith(nowStart.get(i))) {
//if (startDigit.equals(nowStart.get(i))) {
// 判断真的是标题还是干扰项 TODO
if (nowStart.get(i).matches(regex)) {
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit, g, startDigitList, ".");
@@ -1063,4 +1063,30 @@ public class FileSpiltService {
}
return "";
}
public static void main(String[] args) {
String regex="[^\\p{Punct}\\p{Space}\\p{Digit}]";
String arr = "A.1.1 AAA但是发斯蒂芬士大夫是";
String start = arr.substring(0, 1);
String regexStart="\\p{Alpha}";
Matcher matcher1;
matcher1 = Pattern.compile(regexStart).matcher(start);
Matcher matcher;
matcher = Pattern.compile(regex).matcher(arr);
if(matcher.find()) {
int index = matcher.start();
String startDigit = arr.substring(0, index);
startDigit = startDigit.replaceAll(" ", "");
if(StringUtils.isNotBlank(startDigit)) {
String s = startDigit.replaceAll("\t", "").replaceAll("\b", "")
.replaceAll("\"", "").replaceAll("\'", "");
if(matcher1.find()) {
s = regexStart+s;
}
System.out.println(s);
}
}
}
}