+ unsigned len;
+ unichar c0;
+ int occurence;
+
+ iCalDay = [days objectAtIndex:i]; // eg: MO or TU
+ if ((len = [iCalDay length]) == 0) {
+ [self errorWithFormat:@"found an empty day in byday list: '%@'",
+ _byDayList];
+ continue;
+ }
+
+ c0 = [iCalDay characterAtIndex:0];
+ if (((c0 == '+' || c0 == '-') && len > 2) || (isdigit(c0) && len > 1)) {
+ int offset;
+
+ occurence = [iCalDay intValue];
+
+ offset = 1;
+ while (offset < len && isdigit([iCalDay characterAtIndex:offset]))
+ offset++;
+
+ iCalDay = [iCalDay substringFromIndex:offset];
+
+ if (self->byDay.useOccurence) {
+ [self errorWithFormat:
+ @"we only supported one occurence (occ=%i,day=%@): '%@'",
+ occurence, iCalDay, _byDayList];
+ continue;
+ }
+
+ self->byDay.useOccurence = 1;
+ self->byDayOccurence1 = occurence;
+ }
+ else if (self->byDay.useOccurence) {
+ [self errorWithFormat:
+ @"a byday occurence was specified on one day, but not on others"
+ @" (unsupported): '%@'", _byDayList];
+ }