$str
$str : string
String
trim(string $charList, bool $alter) : string
This function returns a string with whitespace stripped from the beginning and end of the string.
string | $charList | A list with all characters that you want to be stripped |
bool | $alter | If true the current string value will be altered, otherwhise it will just be returned but it won't change. |
If $alter is false.
leftTrim(string $charList, bool $alter) : string
This function returns a string with whitespace stripped from the beginning of the string.
string | $charList | A list with all characters that you want to be stripped |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
rightTrim(string $charList, bool $alter) : string
This function returns a string with whitespace stripped from the end of the string.
string | $charList | A list with all characters that you want to be stripped |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
chunkSplit(int $chunkLen, string $end, bool $alter) : string
Split a string into smaller chunks.
int | $chunkLen | The chunk length. |
string | $end | The line ending sequence. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
crypt(string $salt, bool $alter) : string
It will return a hashed string using the standard Unix DES-based algorithm or alternative algorithms that may be available on the system.
string | $salt | An optional salt string to base the hashing on. If not provided, the behaviour is defined by the algorithm implementation and can lead to unexpected results. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
split(string $delimiter, int $limit) : array
Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.
string | $delimiter | The boundary string. |
int | $limit | If limit is set and positive, the returned array will contain a maximum of limit elements with the last element containing the rest of string. If the limit parameter is negative, all components except the last -limit are returned. If the limit parameter is zero, then this is treated as 1.See php documentation for explode. |
Returns an array of strings created by splitting the string parameter on boundaries formed by the delimiter. See php documentation for explode.
parseStr(string $str, array $array)
Parses string as if it were the query string passed via a URL and sets variables in the current scope.
string | $str | The input string. |
array | $array | If the second parameter is present, variables are stored in this variable as array elements instead. |
binToHex(bool $alter) : string|bool
Returns an ASCII string containing the hexadecimal representation of the string. The conversion is done byte-wise with the high-nibble first.
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false or FALSE on failure.
htmlEntities(int $flags, string $encoding, bool $doubleEncode, bool $alter) : string
Convert all applicable characters to HTML entities.
int | $flags | A bitmask of one or more of the following flags, which specify how to handle quotes, invalid code unit sequences and the used document type. The default is ENT_COMPAT | ENT_HTML401. |
string | $encoding | Defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. |
bool | $doubleEncode | When is turned off PHP will not encode existing html entities. The default is to convert everything. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
htmlSpecialChars(int $flags, string $encoding, bool $doubleEncode, bool $alter) : string
Convert special characters to HTML entities.
int | $flags | A bitmask of one or more of the following flags, which specify how to handle quotes, invalid code unit sequences and the used document type. The default is ENT_COMPAT | ENT_HTML401. |
string | $encoding | Defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. |
bool | $doubleEncode | When is turned off PHP will not encode existing html entities. The default is to convert everything. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
htmlSpecialCharsDecode(int $flags, bool $alter) : string
Convert special HTML entities back to characters.
int | $flags | A bitmask of one or more of the following flags, which specify how to handle quotes, invalid code unit sequences and the used document type. The default is ENT_COMPAT | ENT_HTML401. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
join(string $glue, array $pieces, bool $alter, bool $return) : string
Join array elements with a string.
string | $glue | Separator string. Defaults to an empty string. |
array | $pieces | The array of strings to join. |
bool | $alter | If true the current string value will be replaced. |
bool | $return | If true the result will be returned. |
If $return is set to true.
md5(bool $rawOutput, bool $alter) : string
Calculate the md5 hash of a string.
bool | $rawOutput | If it's set to true the md5 digest is instead returned in raw binary format with a length of 16. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
sha1(bool $rawOutput, bool $alter) : string
Calculate the sha1 hash of a string.
bool | $rawOutput | If it's set to true the sha1 digest is instead returned in raw binary format with a length of 20, otherwise the returned value is a 40-character hexadecimal number. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
nlToBr(bool $isXhtml, bool $alter) : string
Inserts HTML line breaks before all newlines in a string.
bool | $isXhtml | Whether to use XHTML compatible line breaks or not. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
similarText(string|String $string, float $percent) : int
Calculate the similarity between two strings-
string|String | $string | The string to compare the current string value to. |
float | $percent | By passing a reference as second argument, the method will calculate the similarity in percent for you. |
The number of matching chars in both strings.
replace(mixed $search, mixed $replace, int $count, bool $alter) : string
Replace all occurrences of the search string with the replacement string.
mixed | $search | The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
mixed | $replace | The replacement value that replaces found search values. An array may be used to designate multiple replacements. |
int | $count | If passed, this will be set to the number of replacements performed. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
wordCount(int $format, string $charList) : int|array
Return information about words used in a string.
int | $format | Specify the return value of this function. See php documentation for more information. |
string | $charList | A list of additional characters which will be considered as 'word'. |
Returns an array or an integer, depending on the format chosen.
compare(string|String $str, bool $caseInsensitive, int $length) : int
Performs a comparison between a string and the current string value of the String object.
string|String | $str | The string to compare to. |
bool | $caseInsensitive | Whether to perform a case insensitive comparison or not. |
int | $length | If set to higher than 0 will perform a comparison of the first $length characters. |
Returns 0 it both strings are equal, 1 if the current string value is greater than the other and -1 otherwhise.
stripTags(string $allowableTags, bool $alter) : string
Strip HTML and PHP tags from a string.
string | $allowableTags | You can use this optional parameter to specify tags which should not be stripped. |
bool | $alter | If true the current string value will be altered, otherwhise it will be returned but it won't change. |
If $alter is false.
indexOf(string|String $needle, int $offset, bool $caseInsensitive) : int
Returns the first position of a string found in the current string value.
string|String | $needle | The string to look for in the current string value. |
int | $offset | If specified, search will start this number of characters counted from the beginning of the string. If the offset is negative it will be omitted. |
bool | $caseInsensitive | Whether to perform a case insensitive search or not. |
The position of where the needle exists relative to the beginnning of the current string value.
lastIndexOf(string|String $needle, int $offset, bool $caseInsensitive) : int
Returns the last position of a string found in the current string value.
string|String | $needle | The string to look for in the current string value. |
int | $offset | If specified, search will start this number of characters counted from the beginning of the string. If the offset is negative it will be omitted. |
bool | $caseInsensitive | Whether to perform a case insensitive search or not. |
The position of where the last occurrence of needle was found relative to the beginnning of the current string value.
substring(int $from, int $to, int $length) : string
Returns part of the string.
int | $from | Start position of the part that will be returned. |
int | $to | If specified, the end position of the part that will be returned. |
int | $length | If specified and $to is not specified, the length of characters to return from the start position set by $from. |
The desired part of the string.
contains(string $needle, bool $caseInsensitive) : bool
Checks if a string is contained in the current string value.
string | $needle | The string to look for in the current string value. |
bool | $caseInsensitive | Whether to perform a case insensitive search or not. |
The existance of the needle in the current string.