我将以下字符串输入到我的方法中 String xymessage="Your item(s) will be ready Today for Pick up by 10:00 am";
现在如何将此字符串转换为日历对象。
我能够提取这一天,即。无论是“今天”还是“明天”。还有时间,即。“10:00 am”使用这两个参数作为输入,即。今天和上午 10:00 我可以将其转换为日历对象吗?示例代码片段:
String xymessage="Your item(s) will be ready Today for pickup by 10:00 a.m. ";
if(null != xyMessage){
//removing empty spaces.
xyMessage=xyMessage.trim();
LOGGER.debug("sellerId:"+delivSeller.getSellerId()+" and xymessage:"+xyMessage);
if(xyMessage.contains("Today")){
//this means its today
String[] xyArray = xyMessage.split("pickup by");
if(xyArray.length == 2){
String timeVal=xyArray[1];
}
}else{
//this means its tomorrow
}
}