今天在代码中看到同事在比较的时候使用了
equalsIgnoreCase 在此我记录下
if (form.status.equalsIgnoreCase("1") ) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");//日期
form.time = simpleDateFormat.format(new Date());
confirmBillCom(form);//确认
}
区别:
equals区分大小写 equalsIgnoreCase 不区分大小写
特定场景使用特定的方法