Commit 80ff848d authored by Quxl's avatar Quxl

x

parent c9886ad7
......@@ -14,22 +14,20 @@ import org.dom4j.Element;
public class StringUtil {
public static Double toDouble(String value) {
Double res;
if(value==null||value.equals("")) {
res = 0.0;
}else {
res = Double.valueOf(value);
if (value == null || value.equals("")) {
return null;
} else {
return Double.valueOf(value);
}
return res;
}
public static String prependZero(int Num, int length) {
return prependZero(Num+"", length);
return prependZero(Num + "", length);
}
public static String prependZero(String Num, int length) {
String prepend = "";
for(int i=Num.length(); i<length; i++) {
for (int i = Num.length(); i < length; i++) {
prepend = prepend + "0";
}
return prepend + Num;
......@@ -59,7 +57,9 @@ public class StringUtil {
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < strs.length; i++) {
String str = String.valueOf(strs[i]);
sb.append((i == 0 && before != null) ? before : "").append(str == null ? "" : str).append(i < strs.length - 1 ? (sign == null ? "" : sign) : "").append((i == strs.length - 1 && after != null) ? after : "");
sb.append((i == 0 && before != null) ? before : "").append(str == null ? "" : str)
.append(i < strs.length - 1 ? (sign == null ? "" : sign) : "")
.append((i == strs.length - 1 && after != null) ? after : "");
}
return String.valueOf(sb);
}
......@@ -71,7 +71,9 @@ public class StringUtil {
} else {
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < count; i++) {
sb.append(i == 0 && before != null ? before : "").append(str).append(i < count - 1 ? (sign == null ? "" : sign) : "").append(i == count - 1 && after != null ? after : "");
sb.append(i == 0 && before != null ? before : "").append(str)
.append(i < count - 1 ? (sign == null ? "" : sign) : "")
.append(i == count - 1 && after != null ? after : "");
}
return String.valueOf(sb);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment