Differences From Artifact [5e48577b79]:
- File src/OFArray.m — part of check-in [a3b6cca867] at 2013-08-08 23:21:30 on branch trunk — OFArray: Add forgotten ivar prefix. (user: js, size: 16126) [annotate] [blame] [check-ins using]
To Artifact [38f8d86997]:
- File
src/OFArray.m
— part of check-in
[f975b722df]
at
2013-08-25 12:14:46
on branch trunk
— Add -[OFArray componentsJoinedByString:options:].
This allows to skip empty components. (user: js, size: 16841) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
394 395 396 397 398 399 400 | return ret; } - (OFString*)componentsJoinedByString: (OFString*)separator { return [self componentsJoinedByString: separator | | > > > > > > > > > > > > > > > > > > < < > > > > > > > > > > > > > > > | | | | | | | < | > | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | return ret; } - (OFString*)componentsJoinedByString: (OFString*)separator { return [self componentsJoinedByString: separator usingSelector: @selector(description) options: 0]; } - (OFString*)componentsJoinedByString: (OFString*)separator options: (int)options { return [self componentsJoinedByString: separator usingSelector: @selector(description) options: options]; } - (OFString*)componentsJoinedByString: (OFString*)separator usingSelector: (SEL)selector { return [self componentsJoinedByString: separator usingSelector: selector options: 0]; } - (OFString*)componentsJoinedByString: (OFString*)separator usingSelector: (SEL)selector options: (int)options { void *pool; OFMutableString *ret; id *objects; size_t i, count; if (separator == nil) @throw [OFInvalidArgumentException exception]; count = [self count]; if (count == 0) return @""; if (count == 1) return [[self firstObject] performSelector: selector]; ret = [OFMutableString string]; pool = objc_autoreleasePoolPush(); objects = [self objects]; if (options & OF_ARRAY_SKIP_EMPTY) { for (i = 0; i < count; i++) { void *pool2 = objc_autoreleasePoolPush(); OFString *component = [objects[i] performSelector: selector]; if ([component length] > 0) { if ([ret length] > 0) [ret appendString: separator]; [ret appendString: component]; } objc_autoreleasePoolPop(pool2); } } else { for (i = 0; i < count - 1; i++) { void *pool2 = objc_autoreleasePoolPush(); [ret appendString: [objects[i] performSelector: selector]]; [ret appendString: separator]; objc_autoreleasePoolPop(pool2); } [ret appendString: [objects[i] performSelector: selector]]; } [ret makeImmutable]; objc_autoreleasePoolPop(pool); return ret; } |
︙ | ︙ |