Browse Source

工具类修改

gao.qiang 2 years ago
parent
commit
1748c61537
1 changed files with 15 additions and 3 deletions
  1. 15 3
      base-common/src/main/java/com/ozs/common/utils/AppendUtils.java

+ 15 - 3
base-common/src/main/java/com/ozs/common/utils/AppendUtils.java

@@ -37,15 +37,27 @@ public class AppendUtils {
     }
 
     public static int stringSplit(String miles) {
+        int substring=0;
         String[] split = miles.split("\\+");
         if (split.length>1) {
-            String substring1 = split[0].substring(1);
+            for (char c : split[0].toCharArray()) {
+                if (c == 'K'||c=='k') {
+                    substring++;
+                }
+            }
             int number = Integer.parseInt(split[1]);
-            int integer = Integer.parseInt(substring1);
+            int integer = Integer.parseInt(split[0].substring(substring));
             integer=integer*1000;
             return integer + number;
         }else {
-            return Integer.parseInt(miles);
+            for (char c : miles.toCharArray()) {
+                if (c == 'K'||c=='k') {
+                    substring++;
+                }
+            }
+            int integer = Integer.parseInt(miles.substring(substring));
+            integer=integer*1000;
+            return integer;
         }
     }
 }