diff options
author | Andrey Andreev <narf@devilix.net> | 2014-02-09 16:30:06 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-02-09 16:30:06 +0100 |
commit | c2804a3f3eb085abcc50e8df51085db7a94c18d2 (patch) | |
tree | b53e8a2798a75fa4f92ee2cc3201635ce7df319a /user_guide_src/source/helpers/inflector_helper.rst | |
parent | f6600f840125eadf2366c2244f78ad95defb156b (diff) | |
parent | db97fe561f03284a287c9a588ac1ff19a9f5e71d (diff) |
Merge branch 'develop' into 'feature/encryption'
Diffstat (limited to 'user_guide_src/source/helpers/inflector_helper.rst')
-rw-r--r-- | user_guide_src/source/helpers/inflector_helper.rst | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index 1f54b76c0..d0cb17c18 100644 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -5,7 +5,12 @@ Inflector Helper The Inflector Helper file contains functions that permits you to change words to plural, singular, camel case, etc. -.. contents:: Page Contents +.. contents:: + :local: + +.. raw:: html + + <div class="custom-index container"></div> Loading this Helper =================== @@ -14,86 +19,78 @@ This helper is loaded using the following code:: $this->load->helper('inflector'); +Available Functions +=================== + The following functions are available: -singular() -========== -.. php:function:: singular($str) +.. function:: singular($str) :param string $str: Input string - :returns: string - -Changes a plural word to singular. Example:: + :returns: A singular word + :rtype: string - echo singular('dogs'); // Prints 'dog' + Changes a plural word to singular. Example:: -plural() -======== + echo singular('dogs'); // Prints 'dog' -.. php:function:: plural($str) +.. function:: plural($str) :param string $str: Input string - :returns: string + :returns: A plular word + :rtype: string -Changes a singular word to plural. Example:: + Changes a singular word to plural. Example:: - echo plural('dog'); // Prints 'dogs' + echo plural('dog'); // Prints 'dogs' -camelize() -========== - -.. php:function:: camelize($str) +.. function:: camelize($str) :param string $str: Input string - :returns: string - -Changes a string of words separated by spaces or underscores to camel -case. Example:: + :returns: Camelized string + :rtype: string - echo camelize('my_dog_spot'); // Prints 'myDogSpot' + Changes a string of words separated by spaces or underscores to camel + case. Example:: -underscore() -============ + echo camelize('my_dog_spot'); // Prints 'myDogSpot' -.. php:function:: camelize($str) +.. function:: underscore($str) :param string $str: Input string - :returns: string + :returns: String containing underscores instead of spaces + :rtype: string -Takes multiple words separated by spaces and underscores them. -Example:: + Takes multiple words separated by spaces and underscores them. + Example:: - echo underscore('my dog spot'); // Prints 'my_dog_spot' + echo underscore('my dog spot'); // Prints 'my_dog_spot' -humanize() -========== - -.. php:function:: camelize($str) +.. function:: humanize($str[, $separator = '_']) :param string $str: Input string :param string $separator: Input separator - :returns: string - -Takes multiple words separated by underscores and adds spaces between -them. Each word is capitalized. + :returns: Humanized string + :rtype: string -Example:: + Takes multiple words separated by underscores and adds spaces between + them. Each word is capitalized. - echo humanize('my_dog_spot'); // Prints 'My Dog Spot' + Example:: -To use dashes instead of underscores:: + echo humanize('my_dog_spot'); // Prints 'My Dog Spot' - echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot' + To use dashes instead of underscores:: -is_countable() -============== + echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot' -.. php:function:: is_countable($word) +.. function:: is_countable($word) :param string $word: Input string - :returns: bool + :returns: TRUE if the word is countable or FALSE if not + :rtype: bool -Checks if the given word has a plural version. Example:: + Checks if the given word has a plural version. Example:: - is_countable('equipment'); // Returns FALSE
\ No newline at end of file + is_countable('equipment'); // Returns FALSE
\ No newline at end of file |