Мой pgrm возвращает новости с веб-страницы в строчном формате. Я хочу разбить строку каждый раз, когда видит формат даты как dd-mm-yyyy. Можно ли разделить каждый раз, когда он видит дату ???Строка прерывания при просмотре формата даты
Pattern patern=Pattern.compile("-");
Matcher matcher = pattern.matcher(s);
while (matcher.find()) {
System.out.println(matcher.group(1));
}
Мой формат данных как этот
String s="Meow looks like cocaine, is 20 times cheaper, more dangerous, and not illegal; with children as young as 14 addicted to it, CM Devendra Fadnavis has asked the Centre to ban it under the Narcotics Act 18-Dec-2014l The girl was allegedly raped by a school supervisor last week; an activist wrote to the DCP following which the police approached and convinced the survivor’s family to register the offence 18-Dec-2014 Former principal of a Mumbai school has written to education minister against reinstatement of a teacher, accused of sexually harassing nearly 40 Std X students, who is now out on bail 19-Dec-2014"
Или, чтобы сохранить дату в строке, 'ДЕЛЕНИЕ ("(<= \\ д {2} -? \\ ш {3} - \\ д {4})")' , – Keppil
Справа. Когда OP сказал split, я автоматически принял поведение метода split. – Malhelo
@Malhelo он отлично работает ... спасибо – chopss