Commit 35313021a60c33fa1201bea5d216adc91e2381ea

Authored by yanghl
1 parent 0339cbdd

数字小数位末尾去0处理

src/main/java/com/xly/util/AdvancedSymbolRemover.java
... ... @@ -28,8 +28,10 @@ public class AdvancedSymbolRemover {
28 28 text = text.replaceAll("<div>", "");
29 29 text = text.replaceAll("&emsp;", "");
30 30  
31   - // 去掉数字末尾无用的 .0 .00
32   - text = text.replaceAll("(?<=\\d)\\.0+(?!\\d)", " ");
  31 + // 1. 去掉整数后面的 .000 → 变成整数
  32 + text = text.replaceAll("(?<=\\d)\\.0+(?!\\d)", "");
  33 + // 2. 去掉小数末尾多余的 0 → .8900000 → .89
  34 + text = text.replaceAll("(?<=\\.\\d)0+(?!\\d)", "");
33 35  
34 36 // 去掉无用文字
35 37 text = text.replaceAll("换一换", "");
... ...