package com.friday.custody.service.trustService.gtja.utils;

/**
 * @Description
 * @Author wulifeng
 * @Date: 2022/3/14
 */
public class NumberUtil {
    public static String parsePercent(String numWithPercent){
        if(numWithPercent==null){
            return null;
        }

        boolean hasPercent = false;
        if(numWithPercent.contains("%")){
            hasPercent = true;
            numWithPercent = numWithPercent.replace("%", "");
            Double aDouble = Double.valueOf(numWithPercent);
            aDouble = aDouble / 100;
            return String.valueOf(aDouble);
        }
        if("-".equals(numWithPercent)){
            numWithPercent = "0";
        }
        return numWithPercent;

    }

    public static void main(String[] args) {
        String a =  "13.00%";
        String s = parsePercent(a);
        System.out.println(s);
    }
}
