Пример #1
0
 /** {@inheritDoc} */
 @Override
 boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
   // See LANG-954: We use {Nd} rather than {IsNd} because Android does not support the Is prefix
   if (parser.isNextNumber()) {
     regex.append("(\\p{Nd}{").append(parser.getFieldWidth()).append("}+)");
   } else {
     regex.append("(\\p{Nd}++)");
   }
   return true;
 }
Пример #2
0
 /** {@inheritDoc} */
 @Override
 void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
   int iValue = Integer.parseInt(value);
   if (iValue < 100) {
     iValue = parser.adjustYear(iValue);
   }
   cal.set(Calendar.YEAR, iValue);
 }