Commit 5039e026 authored by wujipeng's avatar wujipeng
Browse files

优化

parent e3d58e5b
......@@ -350,10 +350,13 @@ public class AnalysisServiceImpl implements AnalysisService {
}
public static void main(String[] args) {
System.out.println(trimChineseNameFromFilename("张三-05_2023-07-05_2023-07-05_2023-07-05_2023-07-0"));
System.out.println(trimChineseNameFromFilename(null));
}
public static String trimChineseNameFromFilename(String filename) {
if (filename == null) {
return "";
}
// 正则表达式匹配连续的中文字符
Pattern pattern = Pattern.compile("[\u4e00-\u9fa5]+");
Matcher matcher = pattern.matcher(filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment