Commit d3a70723 by sikang

5

parent 7f80a13e
......@@ -13,6 +13,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -47,7 +48,8 @@ public class StringFormat {
* 格式化金额
*/
public static String moneyFormat(@Nullable Context context, double money) {
return String.format(context.getString(R.string.moneySymbol) + "%.0f", money).replaceAll(",", ".");
DecimalFormat df = new DecimalFormat("#,###");
return context.getString(R.string.moneySymbol) + df.format(money).replace(",",".");
}
public static String moneyConversion(double paidAmount) {
......@@ -59,7 +61,7 @@ public class StringFormat {
*/
@Nullable
public static String periodFormat(@Nullable Context context, double term, @NonNull String periodUnit) {
String result = "" + (int) term + periodUnitFormat(context, periodUnit);
String result = (int) term + " " + periodUnitFormat(context, periodUnit);
return result;
}
......
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