mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 00:08:49 +00:00
Zürich departures
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@592 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
82413fa953
commit
58cddabbd6
5 changed files with 296 additions and 11 deletions
|
@ -263,6 +263,19 @@ public final class ParserUtils
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
private static final Pattern P_ISO_DATE = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2})");
|
||||
|
||||
public static final void parseIsoDate(final Calendar calendar, final CharSequence str)
|
||||
{
|
||||
final Matcher m = P_ISO_DATE.matcher(str);
|
||||
if (!m.matches())
|
||||
throw new RuntimeException("cannot parse: '" + str + "'");
|
||||
|
||||
calendar.set(Calendar.YEAR, Integer.parseInt(m.group(3)));
|
||||
calendar.set(Calendar.MONTH, Integer.parseInt(m.group(2)) - 1);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(m.group(3)));
|
||||
}
|
||||
|
||||
private static final Pattern P_GERMAN_DATE = Pattern.compile("(\\d{2})[\\./](\\d{2})[\\./](\\d{2,4})");
|
||||
|
||||
public static final void parseGermanDate(final Calendar calendar, final CharSequence str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue