字符串类型转换
来源:互联网 发布:短域名生成算法 编辑:程序博客网 时间:2024/04/30 06:44
public class NumberParseUtil {
private static final Logger logger = LoggerFactory
.getLogger(NumberParseUtil.class);
public static int parseInt(String str) throws Exception {
if (str == null) {
return 0;
} else {
try {
return Integer.parseInt(str);
} catch (Exception e) {
logger.error("int类型转换错误", e);
throw new Exception();
}
}
}
public static float parseFloat(String str) throws Exception {
if (str == null) {
return 0;
} else {
try {
return Float.parseFloat(str);
} catch (Exception e) {
logger.error("float类型转换错误", e);
throw new Exception();
}
}
}
}
private static final Logger logger = LoggerFactory
.getLogger(NumberParseUtil.class);
public static int parseInt(String str) throws Exception {
if (str == null) {
return 0;
} else {
try {
return Integer.parseInt(str);
} catch (Exception e) {
logger.error("int类型转换错误", e);
throw new Exception();
}
}
}
public static float parseFloat(String str) throws Exception {
if (str == null) {
return 0;
} else {
try {
return Float.parseFloat(str);
} catch (Exception e) {
logger.error("float类型转换错误", e);
throw new Exception();
}
}
}
}
阅读全文
0 0
- 字符串时间类型 转换
- 字符串类型转换总结
- 字符串类型转换
- ATL字符串类型转换
- java字符串类型转换
- ATL字符串类型转换
- ATL字符串类型转换
- 字符串相关类型转换
- C++字符串类型转换
- 字符串类型转换
- 字符串类型转换
- 字符串类型转换
- VC++字符串类型转换
- 实数转换为字符串类型
- 日期类型转换成字符串
- 各种字符串类型的转换
- 字符串转换成数值类型
- 字符串 常见类型转换[转]
- HDU 1564 Play a game(巴什博弈)脑洞
- Ansible管理windows系统
- GC 小结
- 微信提现(1)---企业现金红包方式
- 三条命令 搭建 shadowsock 服务器
- 字符串类型转换
- HDU-5967 小R与手机(LCT)
- 常见android手机分辨率
- 读写锁
- omnetpp下学习AODV的记录
- 如何在win10系统中使用vc6.0
- Java关键字及其作用
- maven本地仓库配置
- 【jzoj5246】【NOIP2017模拟8.8A组】【Trip】【笛卡尔树】【tarjan-lca】