1、比较忽略大小写:equalsIgnoreCase。
使用示例:
String xRequestedWith = request.getHeader("X-Requested-With");//判断是否为异步请求if("XMLHttpRequest".equalsIgnoreCase(xRequestedWith)){ rednerView = view;//异步请求}else{ other code ……}
2、SimpleDateFormat
使用示例:
// 设置日期格式DateFormat df = new SimpleDateFormat("yyyy-MM-dd");// 返回格式化后的字符串String currentTime=df.format(new Date());