From 8ede1a2ecbb62577afd32996956c5feaf7ddf9b6 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 5 Oct 2011 13:34:52 -0500 Subject: replacing the old HTML user guide with a Sphinx-managed user guide --- user_guide_src/source/helpers/inflector_helper.rst | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 user_guide_src/source/helpers/inflector_helper.rst (limited to 'user_guide_src/source/helpers/inflector_helper.rst') diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst new file mode 100644 index 000000000..cf246b9de --- /dev/null +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -0,0 +1,79 @@ +################ +Inflector Helper +################ + +The Inflector Helper file contains functions that permits you to change +words to plural, singular, camel case, etc. + +.. contents:: Page Contents + +Loading this Helper +=================== + +This helper is loaded using the following code + +:: + + $this->load->helper('inflector'); + +The following functions are available: + +singular() +========== + +Changes a plural word to singular. Example + +:: + + $word = "dogs"; + echo singular($word); // Returns "dog" + +plural() +======== + +Changes a singular word to plural. Example + +:: + + $word = "dog"; + echo plural($word); // Returns "dogs" + +To force a word to end with "es" use a second "true" argument. + +:: + + $word = "pass"; + echo plural($word, TRUE); // Returns "passes" + +camelize() +========== + +Changes a string of words separated by spaces or underscores to camel +case. Example + +:: + + $word = "my_dog_spot"; + echo camelize($word); // Returns "myDogSpot" + +underscore() +============ + +Takes multiple words separated by spaces and underscores them. Example + +:: + + $word = "my dog spot"; + echo underscore($word); // Returns "my_dog_spot" + +humanize() +========== + +Takes multiple words separated by underscores and adds spaces between +them. Each word is capitalized. Example + +:: + + $word = "my_dog_spot"; + echo humanize($word); // Returns "My Dog Spot" + -- cgit v1.2.3-24-g4f1b