|
@@ -12,22 +12,22 @@ import java.text.DecimalFormat;
|
|
|
* 800m显示为k0+800 ;
|
|
|
* 1000m显示为k1+0;
|
|
|
* 1500m显示为k1+500 ;
|
|
|
- * 2100m显示为k2+100
|
|
|
+ * 2100m显示为k2+100
|
|
|
*/
|
|
|
public class AppendUtils {
|
|
|
public static String stringAppend(Integer number) {
|
|
|
String s = null;
|
|
|
int i = 0;
|
|
|
- if (number >=1000) {
|
|
|
+ if (number >= 1000) {
|
|
|
BigDecimal e = new BigDecimal(number);
|
|
|
BigDecimal f = new BigDecimal(1000);
|
|
|
BigDecimal divide = e.divide(f);
|
|
|
String d = divide.toString();
|
|
|
String[] split = d.split("\\.");
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
- if (split.length==1){
|
|
|
- stringBuilder.append("K"+split[0]+"+0");
|
|
|
- }else {
|
|
|
+ if (split.length == 1) {
|
|
|
+ stringBuilder.append("K" + split[0] + "+0");
|
|
|
+ } else {
|
|
|
stringBuilder.append("K" + split[0]);
|
|
|
if (split.length > 1) {
|
|
|
stringBuilder.append("+");
|
|
@@ -47,26 +47,26 @@ public class AppendUtils {
|
|
|
}
|
|
|
|
|
|
public static int stringSplit(String miles) {
|
|
|
- int substring=0;
|
|
|
+ int substring = 0;
|
|
|
String[] split = miles.split("\\+");
|
|
|
- if (split.length>1) {
|
|
|
+ if (split.length > 1) {
|
|
|
for (char c : split[0].toCharArray()) {
|
|
|
- if (c == 'K') {
|
|
|
+ if (c == 'K' || c == 'k') {
|
|
|
substring++;
|
|
|
}
|
|
|
}
|
|
|
int number = Integer.parseInt(split[1]);
|
|
|
int integer = Integer.parseInt(split[0].substring(substring));
|
|
|
- integer=integer*1000;
|
|
|
+ integer = integer * 1000;
|
|
|
return integer + number;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
for (char c : miles.toCharArray()) {
|
|
|
if (c == 'K') {
|
|
|
substring++;
|
|
|
}
|
|
|
}
|
|
|
int integer = Integer.parseInt(miles.substring(substring));
|
|
|
- integer=integer*1000;
|
|
|
+ integer = integer * 1000;
|
|
|
return integer;
|
|
|
}
|
|
|
}
|