import 'package:zhiying_comm/util/empty_util.dart'; import 'log/let_log.dart'; class ParseUtil { /// /// String 转double /// static double stringParseDouble(final String val, {double defVal = 0.0}) { if (EmptyUtil.isEmpty(val)) return defVal; double rlt = defVal; try { rlt = double.parse(val); } catch (e, s) { Logger.warn(e, s); rlt = defVal; } return rlt; } /// /// string 转 int /// static int stringParseInt(final String val, {int defVal = 0}) { int rlt = defVal; if (!EmptyUtil.isEmpty(val)) { try { rlt = int.parse(val); } catch (e, s) { Logger.warn(e, s); rlt = defVal; } } return rlt; } }