Ver código fonte

stringAppend修改

gao.qiang 1 ano atrás
pai
commit
cc3b5c7146

+ 10 - 2
base-common/src/main/java/com/ozs/common/utils/AppendUtils.java

@@ -26,7 +26,7 @@ public class AppendUtils {
             String[] split = d.split("\\.");
             StringBuilder stringBuilder = new StringBuilder();
             if (split.length == 1) {
-                stringBuilder.append("K" + split[0] + "+0");
+                stringBuilder.append("K" + split[0] + "+000");
             } else {
                 stringBuilder.append("K" + split[0]);
                 if (split.length > 1) {
@@ -38,7 +38,15 @@ public class AppendUtils {
             }
             return stringBuilder.toString();
         } else {
-            return "K0+" + number;
+            if (number==0) {
+                return "K0+000";
+            }else if (number>0&&number<10) {
+                return "K0+00" + number;
+            }else if (number>10&&number<100){
+                return "K0+0" + number;
+            }else {
+                return "K0+" + number;
+            }
         }
     }