public static boolean isEmpty(String str) {
return str == null || str.length() == 0;
}
public static boolean isIntegerEmpty(Integer str) {
return str == null || str == 0;
}
public static Integer stringOfInteger(String sar){
Integer integer = null;
if(sar != null){
integer = Integer.valueOf(sar);
}
return integer;
}
public static Integer stringMaxInteger(String sar){
BigDecimal bigDecimal = new BigDecimal(sar);
BigDecimal decimal = new BigDecimal(Integer.MAX_VALUE);
return bigDecimal.compareTo(decimal);
}
public static double stringToDouble(String stringValue) {
double d = 0;
try {
if (StringUtil.isNotEmpty(stringValue)) {
d = Double.valueOf(stringValue);
}
} catch (Exception e) {
logger.error("stringToDouble Exception = ", e);
return d;
}
return d;
}
public static Integer stringToInteger(String stringValue) {
Integer i = 0;
try {
if (StringUtil.isNotEmpty(stringValue)) {
i = Integer.parseInt(stringValue);
}
} catch (Exception e) {
logger.error("stringToInteger Exception = ", e);
return i;
}
return i;
}
public static float doubleToFloat(Double doubleValue) {
float f = 0;
try {
if (doubleValue != null) {
double d = doubleValue;
f = (float) d;
}
} catch (Exception e) {
logger.error("doubleToFloat Exception = ", e);
return f;
}
return f;
}
public static boolean isInteger(String value) {
try {
Integer.parseInt(value);
return true;
} catch (NumberFormatException e) {
return false;
}
}