fix():格式规范修改

boot3.0
dongzeliang 2025-02-26 22:12:13 +08:00
parent e40d6fcfe2
commit 9a60f4e7c4
1 changed files with 7 additions and 7 deletions

View File

@ -835,8 +835,8 @@ public class Convert {
* *
* @return * @return
*/ */
public static String toDBC (String input) { public static String toDbc(String input) {
return toDBC(input, null); return toDbc(input, null);
} }
/** /**
@ -847,7 +847,7 @@ public class Convert {
* *
* @return * @return
*/ */
public static String toDBC (String text, Set<Character> notConvertSet) { public static String toDbc(String text, Set<Character> notConvertSet) {
char[] c = text.toCharArray(); char[] c = text.toCharArray();
for (int i = 0 ; i < c.length ; i++) { for (int i = 0 ; i < c.length ; i++) {
if (null != notConvertSet && notConvertSet.contains(c[i])) { if (null != notConvertSet && notConvertSet.contains(c[i])) {
@ -857,7 +857,7 @@ public class Convert {
if (c[i] == '\u3000') { if (c[i] == '\u3000') {
c[i] = ' '; c[i] = ' ';
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') { } else if (c[i] > '\uFF00' && c[i] < '') {
c[i] = (char) (c[i] - 65248); c[i] = (char) (c[i] - 65248);
} }
} }
@ -894,12 +894,12 @@ public class Convert {
int integerPart = (int) Math.floor(n); int integerPart = (int) Math.floor(n);
for (int i = 0 ; i < unit[0].length && integerPart > 0 ; i++) { for (int i = 0 ; i < unit[0].length && integerPart > 0 ; i++) {
String p = ""; StringBuilder p = new StringBuilder();
for (int j = 0 ; j < unit[1].length && n > 0 ; j++) { for (int j = 0 ; j < unit[1].length && n > 0 ; j++) {
p = digit[integerPart % 10] + unit[1][j] + p; p.insert(0, digit[integerPart % 10] + unit[1][j]);
integerPart = integerPart / 10; integerPart = integerPart / 10;
} }
s.insert(0, p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i]); s.insert(0, p.toString().replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i]);
} }
return head + s.toString().replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); return head + s.toString().replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
} }