Clicky

iOS Dev Nugget 121 InflectorKit

.

Need to run a code review on your codebase? Hire me

When presenting text to users, it's often convenient to be able to automatically switch between singular and plural forms of words. InflectorKit from Mattt Thompson helps you do that.

Sample code included:

#import "NSString+InflectorKit.h"

for (NSString *singular in @[@"person", @"tomato", @"matrix", @"octopus", @"fish"]) {
  NSLog(@"%@: %@", singular, [singular pluralizedString]);
}

or:

for (NSString *plural in @[@"people", @"tomatoes", @"matrices", @"octopi", @"fish"]) {
  NSLog(@"%@: %@", plural, [plural singularizedString]);
}


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues