如何从包含“ {ts '2017-01-12 16:09:20'} ”的字符串列表中替换“当前时间戳” ,每个字符串的ts值都发生了变化。
eg: //需要将旧时间戳值列表替换为当前时间戳
private void replaceOldTimeStampToCurrentTimeStamp(){
List<String>sampleString = new ArrayList<String>();
sampleString.add("VALUES ('CODE','01234','DDC','DDC','',1,'01100',null,null,'Y','SD','PRODUCT','','','',2200,2603,{ts '2017-04-25 14:09:20'},'dba',{ts '2017-04-25 14:09:20'},'dba')");
sampleString.add("VALUES ('TYPE','NW','New','New','',1,'01100',null,null,'Y','PRODUCT',null,'','',2200,2604,{ts '2017-01-12 16:09:20'},'dba',{ts '2017-01-12 16:09:20'},'dba')");
}
所需的输出:
VALUES('TYPE','NW','New','New','',1,'01100',null,null,'Y','PRODUCT',null,'','',2200,2604 ,当前时间戳,'dba',当前时间戳,'dba')
VALUES('CODE','01234','DDC','DDC','',1,'01100',null,null,'Y','SD','PRODUCT','','',' ',2200,2603,当前时间戳,'dba',当前时间戳,'dba')