package xyz.wbsite.frame.excel.converter;

/**
 * DoubleConverter - Double转化器，重写了对象到String，String到对象的转化方式
 *
 * @author wangbing
 * @version 0.0.1
 * @since 2017-01-01
 */
public class DoubleConverter implements Converter<Double> {

    @Override
    public Double convert(String var) {
        try {
            return Double.parseDouble(var);
        } catch (Exception e) {
            return 0d;
        }
    }

    @Override
    public String string(Double var) {
        if (var == null) {
            return "";
        }
        return String.valueOf(var);
    }
}
