Revision: 24456 http://sourceforge.net/p/bibdesk/svn/24456 Author: hofman Date: 2019-12-11 15:52:10 +0000 (Wed, 11 Dec 2019) Log Message: ----------- use regex to get year and month from date string
Modified Paths: -------------- trunk/bibdesk/BDSKPRISMParser.m Modified: trunk/bibdesk/BDSKPRISMParser.m =================================================================== --- trunk/bibdesk/BDSKPRISMParser.m 2019-12-11 15:29:20 UTC (rev 24455) +++ trunk/bibdesk/BDSKPRISMParser.m 2019-12-11 15:52:10 UTC (rev 24456) @@ -111,11 +111,12 @@ (array = getProperties(node, @"pubDate"))) { NSString *dateString = [array firstObject]; [pubDict setObject:dateString forKey:BDSKDateString]; - array = [dateString componentsSeparatedByString:@"-"]; - if ([array count] > 0) - [pubDict setObject:[array objectAtIndex:0] forKey:BDSKYearString]; - if ([array count] > 1) - [pubDict setObject:[array objectAtIndex:1] forKey:BDSKMonthString]; + AGRegex *regex = [AGRegex regexWithPattern:@"^(\\d+)-(\\d+)\\-(\\d+)"]; + AGRegexMatch *match = [regex findInString:dateString]; + if (match) { + [pubDict setObject:[match groupAtIndex:1] forKey:BDSKYearString]; + [pubDict setObject:[match groupAtIndex:2] forKey:BDSKMonthString]; + } } if ((array = getProperties(node, @"dc:description")) || This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit