随笔小结

mysql  判定某一字段是否为null(不是空串)

select * from   表名  where id  is  not  null;

select *  from  表名 where  id  is   null  ;

 

split 分割 字符串(分隔符如:* ^ : | , .) 及注意点

在进行字符串分割时特殊字符 需要加上“\\”   进行转义   如进行“|”进行分割时,需要这样操作   String.split("\\|") ,否则无法分割成功。

 

java小技巧:用字符串构建日期Date对象

String DateStr = "2010-12-31-23-59-59";
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-kk-mm-ss");
Date DateObj = dateFormat.parse(endDateStr);

 

其中  dateFormat 的格式可以灵活地决定你的时间格式   如   时间字符串为20180808时   可设定格式为      yyyymmdd   则可动态生成相应的date时间。

posted @ 2018-08-10 20:37  疯狂生长  阅读(92)  评论(0编辑  收藏  举报