package cn.sunner.sms2calendar;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Sunner on 6/29/16.
 */
public class N12306Parser extends SMSParser {

    public N12306Parser(String text) {
        super(text);
    }

    @Override
    protected boolean parse() {
        String pattern = ".*[购|签](\\d+)月(\\d+)日(.+[号|铺])([^\\d]+)(\\d+):(\\d+)开。.*";
        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(text);

        if (!m.matches()) {
            return false;
        }

        this.title = m.group(3);
        this.location = m.group(4);
        this.beginTime = new GregorianCalendar(
                Calendar.getInstance().get(Calendar.YEAR),   // Use this year
                Integer.parseInt(m.group(1)),   // Month
                Integer.parseInt(m.group(2)),   // Day
                Integer.parseInt(m.group(5)),   // Hour
                Integer.parseInt(m.group(6))    // Minute
        );

        // set end time to 1 hour later
        endTime = (Calendar) beginTime.clone();
        endTime.add(Calendar.HOUR, 1);

        return true;
    }
}

@@ -597,21 +597,16 @@
         
-this.
 title = 
@@ -625,21 +625,16 @@
         
-this.
 location
@@ -650,23 +650,72 @@
 p(4)
-;%0A        this.
+ + %22%E7%AB%99%22;   // Append %E7%AB%99 to make it more accurate for maps%0A        
 begi

Append 站 to train station name