************判断输入参数是String类型,而需要的0或1的验证[要修改的性别为0或者1]*****************start
public class Test3 {
String sex = "11";
// 判断输入参数是String类型,而需要的0或1的验证[要修改的性别为0或者1]
if (sex != null && isNum(sex)) {
double temp = Double.valueOf(sex);
if (temp == 1 || temp == 0) {
System.out.println(sex);
}
} else {
System.out.println(sex + "================");
}
}
public static boolean isNum(String str) {
try {
new BigDecimal(str);
return true;
} catch (Exception e) {
return false;
}
}
}
*******************************5-15*******************************************************end