📄 datatypeconverter.java
字号:
/*
* Created on 2004-2-27
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.esimple.framework.util;
import java.math.BigDecimal;
/**
* @author steven
*
*/
public class DataTypeConverter {
public static int toInt(String value) throws ConvertException{
try {
int intValue = new Integer( value ).intValue();
return intValue;
} catch (Exception e) {
throw new ConvertException("can not convert String "+ value +" to int");
}
}
public static float toFloat(String value) throws ConvertException{
try {
return new Float( value ).floatValue();
} catch (Exception e) {
throw new ConvertException("can not convert String "+ value +" to float");
}
}
public static double toDouble(String value) throws ConvertException{
try {
return new Double( value ).doubleValue();
} catch (Exception e) {
throw new ConvertException("can not convert String "+ value +" to float");
}
}
public static BigDecimal toBigDecimal(String value) throws ConvertException{
try {
return new BigDecimal(value);
} catch (Exception e) {
throw new ConvertException("can not convert String "+ value +" to float");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -