public static CalendarParsedResult parse(Result result) { String rawText = result.getText(); if (rawText == null) { return null; } int vEventStart = rawText.indexOf("BEGIN:VEVENT"); if (vEventStart < 0) { return null; } String summary = VCardResultParser.matchSingleVCardPrefixedField("SUMMARY", rawText, true); String start = VCardResultParser.matchSingleVCardPrefixedField("DTSTART", rawText, true); String end = VCardResultParser.matchSingleVCardPrefixedField("DTEND", rawText, true); String location = VCardResultParser.matchSingleVCardPrefixedField("LOCATION", rawText, true); String description = VCardResultParser.matchSingleVCardPrefixedField("DESCRIPTION", rawText, true); try { return new CalendarParsedResult(summary, start, end, location, null, description); } catch (IllegalArgumentException iae) { return null; } }
String note = matchSingleVCardPrefixedField("NOTE", rawText, false); String[] addresses = matchVCardPrefixedField("ADR", rawText, true); if (addresses != null) { String org = matchSingleVCardPrefixedField("ORG", rawText, true); String birthday = matchSingleVCardPrefixedField("BDAY", rawText, true); if (!isLikeVCardDate(birthday)) { birthday = null; String title = matchSingleVCardPrefixedField("TITLE", rawText, true); String url = matchSingleVCardPrefixedField("URL", rawText, true); return new AddressBookParsedResult(names, null, phoneNumbers, emails, note, addresses, org, birthday, title, url);