^Status|Draft| ^Todo|Proof read| ====== Inflector Helper ====== Provides methods for working with the pluralization and singularization of words as well as other methods to work with phrases. ===== Methods ===== ==== uncountable() ==== ''uncountable($string)'' checks whether the given string is an uncountable word. Returns TRUE or FALSE. This method uses a words list from the inflector.php file, located into the system/config folder * [string] word to check inflector::uncountable('money'); //returns TRUE inflector::uncountable('book'); //returns FALSE ==== singular() ==== ''singular($str, $count = NULL)'' will attempt to singularize the given string. Returns the string. If a string is uncountable it will return the string without modification. __Note__: this function works for English words only. * [string] word to singularize * [integer] number of things - default NULL inflector::singular('books'); //returns 'book' inflector::singular('books',0); //returns 'books' ==== plural() ==== ''plural($str, $count = NULL)'' will attempt to pluralize the given string. Returns the string. If a string is uncountable it will return the string without modification. __Note__: this function works for English words only. * [string] word to pluralize * [integer] number of things - default NULL inflector::plural('book'); //returns 'books' inflector::plural('book',1); //returns 'book' ==== camelize() ==== ''camelize($str)'' will attempt to camelize the given string. Returns the string. * [string] phrase to camelize inflector::camelize('system_initialization'); //returns 'systemInitialization' inflector::camelize('system initialization'); //returns 'systemInitialization' ==== underscore() ==== ''underscore($str)'' makes a phrase underscored instead of spaced. Returns the string. * [string] phrase to underscore inflector::underscore('Underscores a phrase.'); //returns Underscores_a_phrase.' ==== humanize() ==== ''humanize($str)'' makes a phrase human-readable instead of dashed or underscored. Returns the string. * [string] phrase to make human-readable inflector::humanize('Remove_underscores_from_a_phrase.'); //returns 'Remove underscores from a phrase.' inflector::humanize('Remove-dashes-from-a-phrase.'); //returns 'Remove dashes from a phrase.'