diff options
author | Brennan Thompson <brenjt@gmail.com> | 2014-02-14 20:03:57 +0100 |
---|---|---|
committer | Brennan Thompson <brenjt@gmail.com> | 2014-02-14 20:03:57 +0100 |
commit | 6949f95f6e21980f36095490bf38fc8a172dbc0f (patch) | |
tree | b3141f390acd0051396cda6a3da51c1f98384cca /user_guide_src/source/helpers/inflector_helper.rst | |
parent | 68a02a01a086bbb1b8128ea2744439de84873d11 (diff) | |
parent | 81f036753272391360ba5b64e6dd93c4101a8733 (diff) |
Merge remote-tracking branch 'upstream/develop' into develop
Conflicts:
system/helpers/form_helper.php
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 |