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/helpers/string_helper.html | 189 ---------------------------------- 1 file changed, 189 deletions(-) delete mode 100644 user_guide/helpers/string_helper.html (limited to 'user_guide/helpers/string_helper.html') diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html deleted file mode 100644 index ebdbd3ab2..000000000 --- a/user_guide/helpers/string_helper.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - -String Helper : CodeIgniter User Guide - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 2.0.3

-
- - - - - - - - - -
- - -
- - - -
- - -

String Helper

- -

The String Helper file contains functions that assist in working with strings.

- - -

Loading this Helper

- -

This helper is loaded using the following code:

-$this->load->helper('string'); - -

The following functions are available:

- -

random_string()

- -

Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes.

- -

The first parameter specifies the type of string, the second parameter specifies the length. The following choices are available:

- - alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1 - - -

Usage example:

- -echo random_string('alnum', 16); - - -

increment_string()

- -

Increments a string by appending a number to it or increasing the number. Useful for creating "copies" or a file or duplicating database content which has unique titles or slugs.

- -

Usage example:

- -echo increment_string('file', '_'); // "file_1"
-echo increment_string('file', '-', 2); // "file-2"
-echo increment_string('file-4'); // "file-5"
- - -

alternator()

- -

Allows two or more items to be alternated between, when cycling through a loop. Example:

- -for ($i = 0; $i < 10; $i++)
-{
-    echo alternator('string one', 'string two');
-}
-
- -

You can add as many parameters as you want, and with each iteration of your loop the next item will be returned.

- -for ($i = 0; $i < 10; $i++)
-{
-    echo alternator('one', 'two', 'three', 'four', 'five');
-}
-
- -

Note: To use multiple separate calls to this function simply call the function with no arguments to re-initialize.

- - - -

repeater()

-

Generates repeating copies of the data you submit. Example:

-$string = "\n";
-echo repeater($string, 30);
- -

The above would generate 30 newlines.

-

reduce_double_slashes()

-

Converts double slashes in a string to a single slash, except those found in http://. Example:

-$string = "http://example.com//index.php";
-echo reduce_double_slashes($string); // results in "http://example.com/index.php"
-

trim_slashes()

-

Removes any leading/trailing slashes from a string. Example:
-
- $string = "/this/that/theother/";
-echo trim_slashes($string); // results in this/that/theother

- - -

reduce_multiples()

-

Reduces multiple instances of a particular character occuring directly after each other. Example:

- -$string="Fred, Bill,, Joe, Jimmy";
-$string=reduce_multiples($string,","); //results in "Fred, Bill, Joe, Jimmy" -
-

The function accepts the following parameters: -reduce_multiples(string: text to search in, string: character to reduce, boolean: whether to remove the character from the front and end of the string) - -The first parameter contains the string in which you want to reduce the multiplies. The second parameter contains the character you want to have reduced. -The third parameter is FALSE by default; if set to TRUE it will remove occurences of the character at the beginning and the end of the string. Example: - - -$string=",Fred, Bill,, Joe, Jimmy,";
-$string=reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy" -
-

- -

quotes_to_entities()

-

Converts single and double quotes in a string to the corresponding HTML entities. Example:

-$string="Joe's \"dinner\"";
-$string=quotes_to_entities($string); //results in "Joe&#39;s &quot;dinner&quot;" -
- -

strip_quotes()

-

Removes single and double quotes from a string. Example:

-$string="Joe's \"dinner\"";
-$string=strip_quotes($string); //results in "Joes dinner" -
- -
- - - - - - - -- cgit v1.2.3-24-g4f1b