String Class Reference

Public Member Functions | |
| cleanInsert ($str, $options) | |
| insert ($str, $data, $options=array()) | |
Static Public Member Functions | |
| & | getInstance () |
| tokenize ($data, $separator= ',', $leftBound= '(', $rightBound= ')') | |
| uuid () | |
Detailed Description
Definition at line 35 of file string.php.
Member Function Documentation
| String::cleanInsert | ( | $ | str, | |
| $ | options | |||
| ) |
Cleans up a Set::insert formated string with given $options depending on the 'clean' key in $options. The default method used is text but html is also available. The goal of this function is to replace all whitespace and uneeded markup around placeholders that did not get replaced by Set::insert.
- Parameters:
-
string $str string $options
- Returns:
- void public
Definition at line 265 of file string.php.
Referenced by insert().
| & String::getInstance | ( | ) | [static] |
Gets a reference to the String object instance
- Returns:
- object String instance public
Definition at line 43 of file string.php.
| String::insert | ( | $ | str, | |
| $ | data, | |||
| $ | options = array() | |||
| ) |
Replaces variable placeholders inside a $str with any given $data. Each key in the $data array corresponds to a variable placeholder name in $str. Example:
Sample: String::insert('My name is :name and I am :age years old.', array('name' => 'Bob', '65')); Returns: My name is Bob and I am 65 years old.
Available $options are: before: The character or string in front of the name of the variable placeholder (Defaults to ':') after: The character or string after the name of the variable placeholder (Defaults to null) escape: The character or string used to escape the before character / string (Defaults to '\') format: A regex to use for matching variable placeholders. Default is: '/(?<!\)\:s/' (Overwrites before, after, breaks escape / clean) clean: A boolean or array with instructions for String::cleanInsert
- Parameters:
-
string $str A string containing variable placeholders string $data A key => val array where each key stands for a placeholder variable name to be replaced with val string $options An array of options, see description above
- Returns:
- string public
Definition at line 214 of file string.php.
References $pos, and cleanInsert().
Referenced by DboSource::query(), and Inflector::slug().
| String::tokenize | ( | $ | data, | |
| $ | separator = ',', |
|||
| $ | leftBound = '(', |
|||
| $ | rightBound = ')' | |||
| ) | [static] |
Tokenizes a string using $separator, ignoring any instance of $separator that appears between $leftBound and $rightBound
- Parameters:
-
string $data The data to tokenize string $separator The token to split the data on
- Returns:
- string public
Definition at line 131 of file string.php.
Referenced by Model::_findList(), Set::classicExtract(), and DboSource::fields().
| String::uuid | ( | ) | [static] |
Generate a random UUID
- See also:
- http://www.ietf.org/rfc/rfc4122.txt
- Returns:
- RFC 4122 UUID
Definition at line 58 of file string.php.
References env(), and Configure::read().
Referenced by Security::generateAuthKey(), and Model::save().
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/string.php