String Class Info:
- Class Declaration:
class String
- File name:
- cake/libs/string.php
- Description:
String handling methods.
- Package
- cake
- Subpackage
- cake.cake.libs
Properties:
cleanInsert
topCleans up a String::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 String::insert().
- Parameters:
-
-
string $str required
-
string $options required
-
- Method defined in:
- cake/libs/string.php on line 275
- Return
string
- Access
public
- Static
- See
insert
topReplaces variable placeholders inside a $str with any given $data. Each key in the $data array
corresponds to a variable placeholder name in $str.
Example: String::insert(':name is :age years old.', array('name' => 'Bob', '65'));
Returns: Bob is 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 required
A string containing variable placeholders
-
string $data required
A key => val array where each key stands for a placeholder variable name to be replaced with val
-
string $options optional array ( )
An array of options, see description above
-
- Method defined in:
- cake/libs/string.php on line 208
- Return
string
- Access
public
- Static
tokenize
topTokenizes a string using $separator, ignoring any instance of $separator that appears between $leftBound and $rightBound
- Parameters:
-
-
string $data required
The data to tokenize
-
string $separator optional ','
The token to split the data on.
-
string $leftBound optional '('
The left boundary to ignore separators in.
-
string $rightBound optional ')'
The right boundary to ignore separators in.
-
- Method defined in:
- cake/libs/string.php on line 117
- Return
array Array of tokens in $data.
- Access
public
- Static
uuid
topGenerate a random UUID
- Method defined in:
- cake/libs/string.php on line 37
- See
http://www.ietf.org/rfc/rfc4122.txt
- Return
RFC 4122 UUID
- Static