From b0dd10f8171945e0c1f3527dd1e9d18b043e01a7 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 25 Aug 2006 17:25:49 +0000 Subject: Initial Import --- user_guide/helpers/string_helper.html | 144 ++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create 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 new file mode 100644 index 000000000..dfe8ae7d6 --- /dev/null +++ b/user_guide/helpers/string_helper.html @@ -0,0 +1,144 @@ + + + + +Code Igniter User Guide + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

Code Igniter User Guide Version 1.4.0

+
+ + + + + + + + + +
+ + +
+ + + +
+ + +

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:

+ + + + +

Usage example:

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

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 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.

+ + + + +
+ + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b