package com.yh.saas.plugin.yiliangyiyun.util;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class StringSizeUtil {

    public static String stringSize(String a){

        if (a.length()<2){
            return "0"+a;
        }else {
            return a;
        }
    }


    public static String exchangeRateTransform(Double param){

        if (param == 0){
            return "0";
        }else{
            BigDecimal decimal = new BigDecimal(param);
            BigDecimal percentage = decimal.setScale(2, RoundingMode.HALF_UP);
            //去掉小数点后多余的0
            return percentage.stripTrailingZeros().toPlainString();
        }
    }
}
