Commit 9bf201236cb6b78958d121aaaf614a3131512602
Merge remote-tracking branch 'origin/master'
Showing
1 changed file
with
4 additions
and
2 deletions
src/main/java/com/xly/util/AdvancedSymbolRemover.java
| @@ -28,8 +28,10 @@ public class AdvancedSymbolRemover { | @@ -28,8 +28,10 @@ public class AdvancedSymbolRemover { | ||
| 28 | text = text.replaceAll("<div>", ""); | 28 | text = text.replaceAll("<div>", ""); |
| 29 | text = text.replaceAll(" ", ""); | 29 | text = text.replaceAll(" ", ""); |
| 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 | text = text.replaceAll("换一换", ""); | 37 | text = text.replaceAll("换一换", ""); |