Inflector on GitHub:
http://github.com/enormego/inflector/tree/masterAuthors:
Inflector
An implementation of the Ruby on Rails inflector in Objective-C.
Requirements
RegexKit(Lite) is required – RegexKitLite is included in the repository, so you can just add it to your project along with the Inflector files. If you are already using RegexKit you won't need to add RegexKitLite as well.
Inflections
All the default Rails inflections are included in the inflections.plist file. You can add more by editing this file, or by using the -[CWInflector addXxx…] methods (see CWInflector.h for the list). For example:
[[CWInflector inflector] addPluralPattern:@"(buffal|tomat)o$" substitution:@"$1oes"];
Usage
To use Inflector, add the CWInflector.mm to your target’s Compile Sources build phase, and add the inflections.plist file to your target’s Copy Bundle Resources build phase. Then #import "CWInflector.h" in your code and you can start inflecting.
Currently there is support for converting words to their singular or plural forms, and for converting identifiers into a more human readable version. All operations can be performed either through the CWInflector singleton instance, or through the NSString category methods:
[[CWInflector inflector] pluralFormOf:@"Sheep"]; // => @"Sheep"
[@"Bus" pluralForm]; // => @"Buses"
[@"product_category_id" humanizedForm]; // => @"Product category"
- Activity
- shaun commented on issue 2 on… Thursday
- shaun commented on issue 2 on… Thursday
- shaun commented on issue 2 on… Thursday
- shaun commented on issue 2 on… Thursday
- shaun merged pull request 13… Apr 26
- shaun merged pull request 12… Apr 19
- shaun merged pull request 23… Apr 17
- shaun merged pull request 14… Apr 17
- shaun merged pull request 13… Apr 17
- shaun opened pull request 10… Apr 4
- View all of our open source projects
- Tweet Tweet
- Anyone have any experience wi… Apr 28
- Go check out @gifture from ou… Apr 26
- RT @saveriomondelli: Today is… Apr 26
- RT @saveriomondelli: If anyon… Apr 25
- @noel_llopis Credit goes to @… Apr 25
- @steipete Nope, order page sa… Apr 25
- @noel_llopis http://t.co/cWX7… Apr 25
- I wouldn't normally be concer… Apr 25
- Did anyone order a WWDC ticke… Apr 25
- RT @whitneyhess: I want to li… Apr 19
- Follow us on twitter
- About Us
- We develop awesome applications for the iPhone, Mac and Web. Our applications are powerful, simple and elegant. This website is our attempt at giving back a little bit of what we've learned over the years. Hope you enjoy it!
- Check out enormego.com for more!
-