这是代码:
public static String removeDateFromString(String txt) {
String dateRemovedString = new String();
String[] str = txt.split("-");
for(int i=0; i<str.length; i++) {
SimpleDateFormat format = new SimpleDateFormat("dd MMM");
try {
format.parse(str[i]);
} catch(ParseException e) {
dateRemovedString.concat(str[i]);
}
}
return dateRemovedString;
}
为了,
输入文本:Cricket Match - 01 Jul
输出文本:(""
空字符串)
但我想要,输出:Cricket Match
我应该怎么办?