|
@@ -11,19 +11,19 @@ import java.text.DecimalFormat;
|
|
|
public class AppendUtils {
|
|
|
public static String stringAppend(Integer number) {
|
|
|
String s = null;
|
|
|
- int i=0;
|
|
|
+ int i = 0;
|
|
|
if (number > 1000) {
|
|
|
BigDecimal e = new BigDecimal(number);
|
|
|
BigDecimal f = new BigDecimal(1000);
|
|
|
BigDecimal divide = e.divide(f);
|
|
|
- String d=divide.toString();
|
|
|
+ String d = divide.toString();
|
|
|
String[] split = d.split("\\.");
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
stringBuilder.append("K" + split[0]);
|
|
|
- if (!ObjectUtils.isEmpty(split[1])) {
|
|
|
+ if (split.length>1) {
|
|
|
stringBuilder.append("+");
|
|
|
- for(char c : split[1].toCharArray()) {
|
|
|
- if (c=='0'){
|
|
|
+ for (char c : split[1].toCharArray()) {
|
|
|
+ if (c == '0') {
|
|
|
i++;
|
|
|
}
|
|
|
}
|
|
@@ -32,7 +32,20 @@ public class AppendUtils {
|
|
|
}
|
|
|
return stringBuilder.toString();
|
|
|
} else {
|
|
|
- return s = String.valueOf(number);
|
|
|
+ return s = String.valueOf(number);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static int stringSplit(String miles) {
|
|
|
+ String[] split = miles.split("\\+");
|
|
|
+ if (split.length>1) {
|
|
|
+ String substring1 = split[0].substring(1);
|
|
|
+ int number = Integer.parseInt(split[1]);
|
|
|
+ int integer = Integer.parseInt(substring1);
|
|
|
+ integer=integer*1000;
|
|
|
+ return integer + number;
|
|
|
+ }else {
|
|
|
+ return Integer.parseInt(miles);
|
|
|
}
|
|
|
}
|
|
|
}
|