现在的位置: 首页 > 综合 > 正文

lastIndexOf()

2013年10月06日 ⁄ 综合 ⁄ 共 327字 ⁄ 字号 评论关闭
// システム日付     
  Calendar cal = Calendar.getInstance();      
 cal.getTime();    
   Timestamp sysdate = new Timestamp(cal.getTimeInMillis());   //2008-06-23 11:37:57.846
int last = sysdate.toString().lastIndexOf(".");     //    last= 19    
 String date = sysdate.toString().substring(0,last)+".0"; //2008-06-23 11:37:57.0
  lastIndexOf()返回 String 对象中子字符串最后出现的位置。

抱歉!评论已关闭.