$_lowers
$_lowers : array
lower() cache.
Provides static methods for charset and locale safe string manipulation.
Copyright 2003-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
convertCharset(mixed $input, string $from, string $to, boolean $force = false) : mixed
Converts a string from one charset to another.
Uses the iconv or the mbstring extensions. The original string is returned if conversion failed or none of the extensions were available.
mixed | $input | The data to be converted. If $input is an an array, the array's values get converted recursively. |
string | $from | The string's current charset. |
string | $to | The charset to convert the string to. |
boolean | $force | Force conversion? |
The converted input data.
lower(string $string, boolean $locale = false, string $charset = null) : string
Makes a string lowercase.
string | $string | The string to be converted. |
boolean | $locale | If true the string will be converted based on a given charset, locale independent else. |
string | $charset | If $locale is true, the charset to use when converting. |
The string with lowercase characters.
upper(string $string, boolean $locale = false, string $charset = null) : string
Makes a string uppercase.
string | $string | The string to be converted. |
boolean | $locale | If true the string will be converted based on a given charset, locale independent else. |
string | $charset | If $locale is true, the charset to use when converting. If not provided the current charset. |
The string with uppercase characters.
ucfirst(string $string, boolean $locale = false, string $charset = null) : string
Returns a string with the first letter capitalized if it is alphabetic.
string | $string | The string to be capitalized. |
boolean | $locale | If true the string will be converted based on a given charset, locale independent else. |
string | $charset | The charset to use, defaults to current charset. |
The capitalized string.
ucwords(string $string, boolean $locale = false, string $charset = null) : string
Returns a string with the first letter of each word capitalized if it is alphabetic.
Sentences are splitted into words at whitestrings.
string | $string | The string to be capitalized. |
boolean | $locale | If true the string will be converted based on a given charset, locale independent else. |
string | $charset | The charset to use, defaults to current charset. |
The capitalized string.
substr(string $string, integer $start, integer $length = null, string $charset = 'UTF-8') : string
Returns part of a string.
string | $string | The string to be converted. |
integer | $start | The part's start position, zero based. |
integer | $length | The part's length. |
string | $charset | The charset to use when calculating the part's position and length, defaults to current charset. |
The string's part.
pos(string $haystack, string $needle, integer $offset, string $charset = 'UTF-8') : integer
Returns the numeric position of the first occurrence of $needle in the $haystack string.
string | $haystack | The string to search through. |
string | $needle | The string to search for. |
integer | $offset | Character in $haystack to start searching at. |
string | $charset | Charset of $needle. |
The position of first occurrence.
ipos(string $haystack, string $needle, integer $offset, string $charset = 'UTF-8') : integer
Returns the numeric position of the first case-insensitive occurrence of $needle in the $haystack string.
string | $haystack | The string to search through. |
string | $needle | The string to search for. |
integer | $offset | Character in $haystack to start searching at. |
string | $charset | Charset of $needle. |
The position of first case-insensitive occurrence.
rpos(string $haystack, string $needle, integer $offset, string $charset = 'UTF-8') : integer
Returns the numeric position of the last occurrence of $needle in the $haystack string.
string | $haystack | The string to search through. |
string | $needle | The string to search for. |
integer | $offset | Character in $haystack to start searching at. |
string | $charset | Charset of $needle. |
The position of last occurrence.
ripos(string $haystack, string $needle, integer $offset, string $charset = 'UTF-8') : integer
Returns the numeric position of the last case-insensitive occurrence of $needle in the $haystack string.
string | $haystack | The string to search through. |
string | $needle | The string to search for. |
integer | $offset | Character in $haystack to start searching at. |
string | $charset | Charset of $needle. |
The position of last case-insensitive occurrence.
pad(string $input, integer $length, string $pad = ' ', \const $type = STR_PAD_RIGHT, string $charset = 'UTF-8') : string
Returns a string padded to a certain length with another string.
This method behaves exactly like str_pad() but is multibyte safe.
string | $input | The string to be padded. |
integer | $length | The length of the resulting string. |
string | $pad | The string to pad the input string with. Must be in the same charset like the input string. |
\const | $type | The padding type. One of STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH. |
string | $charset | The charset of the input and the padding strings. |
The padded string.
wordwrap(string $string, integer $width = 75, string $break = "\n", boolean $cut = false, boolean $line_folding = false) : string
Wraps the text of a message.
string | $string | String containing the text to wrap. |
integer | $width | Wrap the string at this number of characters. |
string | $break | Character(s) to use when breaking lines. |
boolean | $cut | Whether to cut inside words if a line can't be wrapped. |
boolean | $line_folding | Whether to apply line folding rules per RFC 822 or similar. The correct break characters including leading whitespace have to be specified too. |
String containing the wrapped text.
wrap(string $text, integer $length = 80, string $break_char = "\n", boolean $quote = false) : string
Wraps the text of a message.
string | $text | String containing the text to wrap. |
integer | $length | Wrap $text at this number of characters. |
string | $break_char | Character(s) to use when breaking lines. |
boolean | $quote | Ignore lines that are wrapped with the '>' character (RFC 2646)? If true, we don't remove any padding whitespace at the end of the string. |
String containing the wrapped text.
abbreviate(string $text, integer $length = 20) : string
Return an abbreviated string, with characters in the middle of the excessively long string replaced by '.
..'.
string | $text | The original string. |
integer | $length | The length at which to abbreviate. |
The abbreviated string, if longer than $length.
isAlpha(string $string, string $charset) : boolean
Returns true if the every character in the parameter is an alphabetic character.
string | $string | The string to test. |
string | $charset | The charset to use when testing the string. |
True if the parameter was alphabetic only.
isLower(string $string, string $charset) : boolean
Returns true if ever character in the parameter is a lowercase letter in the current locale.
string | $string | The string to test. |
string | $charset | The charset to use when testing the string. |
True if the parameter was lowercase.
isUpper(string $string, string $charset) : boolean
Returns true if every character in the parameter is an uppercase letter in the current locale.
string | $string | The string to test. |
string | $charset | The charset to use when testing the string. |
True if the parameter was uppercase.
regexMatch(string $text, array $regex, string $charset = null) : array
Performs a multibyte safe regex match search on the text provided.
string | $text | The text to search. |
array | $regex | The regular expressions to use, without perl regex delimiters (e.g. '/' or '|'). |
string | $charset | The character set of the text. |
The matches array from the first regex that matches.
_convertCharset(string $input, string $from, string $to) : string
Internal function used to do charset conversion.
string | $input | See self::convertCharset(). |
string | $from | See self::convertCharset(). |
string | $to | See self::convertCharset(). |
The converted string.
_pos(string $haystack, string $needle, integer $offset, string $charset, string $func) : integer
Perform string position searches.
string | $haystack | The string to search through. |
string | $needle | The string to search for. |
integer | $offset | Character in $haystack to start searching at. |
string | $charset | Charset of $needle. |
string | $func | Function to use. |
The position of occurrence.