![]() |
TeamSpeak 3 PHP Framework
1.1.16
Copyright © Planet TeamSpeak. All rights reserved.
|
Helper class for string handling. More...
Public Member Functions | |
__construct ($string) | |
The TeamSpeak3_Helper_String constructor. | |
replace ($search, $replace, $caseSensitivity=TRUE) | |
Replaces every occurrence of the string $search with the string $replace. | |
arg (array $args, $char="%") | |
This function replaces indexed or associative signs with given values. | |
startsWith ($pattern) | |
Returns true if the string starts with $pattern. | |
endsWith ($pattern) | |
Returns true if the string ends with $pattern. | |
findFirst ($needle) | |
Returns the position of the first occurrence of a char in a string. | |
findLast ($needle) | |
Returns the position of the last occurrence of a char in a string. | |
toLower () | |
Returns the lowercased string. | |
toUpper () | |
Returns the uppercased string. | |
contains ($pattern, $regexp=FALSE) | |
Returns true if the string contains $pattern. | |
substr ($start, $length=null) | |
Returns part of a string. | |
split ($separator, $limit=0) | |
Splits the string into substrings wherever $separator occurs. | |
append ($part) | |
Appends $part to the string. | |
prepend ($part) | |
Prepends $part to the string. | |
section ($separator, $first=0, $last=0) | |
Returns a section of the string. | |
resize ($size, $char="\0") | |
Sets the size of the string to $size characters. | |
trim () | |
Strips whitespaces (or other characters) from the beginning and end of the string. | |
escape () | |
Escapes a string using the TeamSpeak 3 escape patterns. | |
unescape () | |
Unescapes a string using the TeamSpeak 3 escape patterns. | |
filterAlnum () | |
Removes any non alphanumeric characters from the string. | |
filterAlpha () | |
Removes any non alphabetic characters from the string. | |
filterDigits () | |
Removes any non numeric characters from the string. | |
isInt () | |
Returns TRUE if the string is a numeric value. | |
toInt () | |
Returns the integer value of the string. | |
toCrc32 () | |
Calculates and returns the crc32 polynomial of the string. | |
toMd5 () | |
Calculates and returns the md5 checksum of the string. | |
toSha1 () | |
Calculates and returns the sha1 checksum of the string. | |
isUtf8 () | |
Returns TRUE if the string is UTF-8 encoded. | |
toUtf8 () | |
Converts the string to UTF-8. | |
toBase64 () | |
Encodes the string with MIME base64 and returns the result. | |
toHex () | |
Returns the hexadecimal value of the string. | |
transliterate () | |
Returns the string transliterated from UTF-8 to Latin. | |
uriSafe ($spacer="-") | |
Processes the string and replaces all accented UTF-8 characters by unaccented ASCII-7 "equivalents", whitespaces are replaced by a pre-defined spacer and the string is lowercase. | |
spaceToPercent () | |
Replaces space characters with percent encoded strings. | |
toString () | |
Returns the string as a standard string. | |
__call ($function, $args) | |
Magical function that allows you to call PHP's built-in string functions on the TeamSpeak3_Helper_String object. | |
__toString () | |
Returns the character as a standard string. | |
count () | |
| |
rewind () | |
| |
valid () | |
| |
key () | |
| |
current () | |
| |
next () | |
| |
offsetExists ($offset) | |
| |
offsetGet ($offset) | |
| |
offsetSet ($offset, $value) | |
| |
offsetUnset ($offset) | |
| |
Static Public Member Functions | |
static | factory ($string) |
Returns a TeamSpeak3_Helper_String object for thegiven string. | |
static | fromBase64 ($base64) |
Decodes the string with MIME base64 and returns the result as an TeamSpeak3_Helper_String. | |
static | fromHex ($hex) |
Returns the TeamSpeak3_Helper_String based on a given hex value. | |
Protected Attributes | |
$string | |
$position = 0 | |
| |
Helper class for string handling.
Definition at line 32 of file String.php.
TeamSpeak3_Helper_String::__construct | ( | $string | ) |
The TeamSpeak3_Helper_String constructor.
string | $string |
Definition at line 52 of file String.php.
|
static |
Returns a TeamSpeak3_Helper_String object for thegiven string.
string | $string |
Definition at line 63 of file String.php.
Referenced by TeamSpeak3_Viewer_Text\fetchObject(), TeamSpeak3_Viewer_Html\fetchObject(), TeamSpeak3\getAdapterName(), TeamSpeak3_Transport_Abstract\getAdapterType(), TeamSpeak3_Node_Abstract\getClass(), TeamSpeak3_Node_Abstract\getInfo(), TeamSpeak3_Helper_Convert\logEntry(), TeamSpeak3_Node_Host\permissionTree(), TeamSpeak3_Adapter_ServerQuery\prepare(), TeamSpeak3_Transport_TCP\readLine(), TeamSpeak3_Adapter_ServerQuery\request(), TeamSpeak3_Node_Host\serverGetByTSDNS(), TeamSpeak3_Node_Server\serverGroupGetProfiles(), TeamSpeak3_Node_Server\snapshotDeploy(), and TeamSpeak3_Node_Host\whoamiSet().
TeamSpeak3_Helper_String::replace | ( | $search, | |
$replace, | |||
$caseSensitivity = TRUE |
|||
) |
Replaces every occurrence of the string $search with the string $replace.
string | $search | |
string | $replace | |
boolean | $caseSensitivity |
Definition at line 76 of file String.php.
TeamSpeak3_Helper_String::arg | ( | array | $args, |
$char = "%" |
|||
) |
This function replaces indexed or associative signs with given values.
array | $args | |
string | $char |
Definition at line 97 of file String.php.
Referenced by TeamSpeak3_Exception\prepareCustomMessage().
TeamSpeak3_Helper_String::startsWith | ( | $pattern | ) |
Returns true if the string starts with $pattern.
string | $pattern |
Definition at line 118 of file String.php.
References substr().
Referenced by TeamSpeak3_Adapter_ServerQuery_Event\__construct().
TeamSpeak3_Helper_String::endsWith | ( | $pattern | ) |
Returns true if the string ends with $pattern.
string | $pattern |
Definition at line 129 of file String.php.
References substr().
TeamSpeak3_Helper_String::findFirst | ( | $needle | ) |
Returns the position of the first occurrence of a char in a string.
string | $needle |
Definition at line 140 of file String.php.
TeamSpeak3_Helper_String::findLast | ( | $needle | ) |
Returns the position of the last occurrence of a char in a string.
string | $needle |
Definition at line 151 of file String.php.
TeamSpeak3_Helper_String::toLower | ( | ) |
Returns the lowercased string.
Definition at line 161 of file String.php.
TeamSpeak3_Helper_String::toUpper | ( | ) |
Returns the uppercased string.
Definition at line 171 of file String.php.
TeamSpeak3_Helper_String::contains | ( | $pattern, | |
$regexp = FALSE |
|||
) |
Returns true if the string contains $pattern.
string | $pattern | |
booean | $regexp |
Definition at line 183 of file String.php.
Referenced by isInt().
TeamSpeak3_Helper_String::substr | ( | $start, | |
$length = null |
|||
) |
Returns part of a string.
integer | $start | |
integer | $length |
Definition at line 207 of file String.php.
Referenced by endsWith(), resize(), and startsWith().
TeamSpeak3_Helper_String::split | ( | $separator, | |
$limit = 0 |
|||
) |
Splits the string into substrings wherever $separator occurs.
string | $separator | |
integer | $limit |
Definition at line 221 of file String.php.
References count().
Referenced by TeamSpeak3_Adapter_ServerQuery_Event\__construct().
TeamSpeak3_Helper_String::append | ( | $part | ) |
Appends $part to the string.
string | $part |
Definition at line 239 of file String.php.
TeamSpeak3_Helper_String::prepend | ( | $part | ) |
Prepends $part to the string.
string | $part |
Definition at line 252 of file String.php.
TeamSpeak3_Helper_String::section | ( | $separator, | |
$first = 0 , |
|||
$last = 0 |
|||
) |
Returns a section of the string.
string | $separator | |
integer | $first | |
integer | $last |
Definition at line 267 of file String.php.
References count().
Referenced by TeamSpeak3_Adapter_ServerQuery\request(), and TeamSpeak3_Adapter_ServerQuery\wait().
TeamSpeak3_Helper_String::resize | ( | $size, | |
$char = "\0" |
|||
) |
Sets the size of the string to $size characters.
integer | $size | |
string | $char |
Definition at line 298 of file String.php.
TeamSpeak3_Helper_String::trim | ( | ) |
Strips whitespaces (or other characters) from the beginning and end of the string.
Definition at line 319 of file String.php.
Referenced by uriSafe().
TeamSpeak3_Helper_String::escape | ( | ) |
Escapes a string using the TeamSpeak 3 escape patterns.
Definition at line 331 of file String.php.
References TeamSpeak3\getEscapePatterns().
TeamSpeak3_Helper_String::unescape | ( | ) |
Unescapes a string using the TeamSpeak 3 escape patterns.
Definition at line 346 of file String.php.
References TeamSpeak3\getEscapePatterns().
TeamSpeak3_Helper_String::filterAlnum | ( | ) |
Removes any non alphanumeric characters from the string.
Definition at line 358 of file String.php.
TeamSpeak3_Helper_String::filterAlpha | ( | ) |
Removes any non alphabetic characters from the string.
Definition at line 370 of file String.php.
TeamSpeak3_Helper_String::filterDigits | ( | ) |
Removes any non numeric characters from the string.
Definition at line 382 of file String.php.
TeamSpeak3_Helper_String::isInt | ( | ) |
Returns TRUE if the string is a numeric value.
Definition at line 394 of file String.php.
References contains().
TeamSpeak3_Helper_String::toInt | ( | ) |
Returns the integer value of the string.
Definition at line 405 of file String.php.
TeamSpeak3_Helper_String::toCrc32 | ( | ) |
Calculates and returns the crc32 polynomial of the string.
Definition at line 420 of file String.php.
TeamSpeak3_Helper_String::toMd5 | ( | ) |
Calculates and returns the md5 checksum of the string.
Definition at line 430 of file String.php.
TeamSpeak3_Helper_String::toSha1 | ( | ) |
Calculates and returns the sha1 checksum of the string.
Definition at line 440 of file String.php.
TeamSpeak3_Helper_String::isUtf8 | ( | ) |
Returns TRUE if the string is UTF-8 encoded.
This method searches for non-ascii multibyte sequences in the UTF-8 range.
Definition at line 451 of file String.php.
Referenced by toUtf8().
TeamSpeak3_Helper_String::toUtf8 | ( | ) |
Converts the string to UTF-8.
Definition at line 473 of file String.php.
References isUtf8().
Referenced by transliterate().
TeamSpeak3_Helper_String::toBase64 | ( | ) |
Encodes the string with MIME base64 and returns the result.
Definition at line 488 of file String.php.
|
static |
Decodes the string with MIME base64 and returns the result as an TeamSpeak3_Helper_String.
string |
Definition at line 499 of file String.php.
Referenced by TeamSpeak3_Node_Server\snapshotDeploy().
TeamSpeak3_Helper_String::toHex | ( | ) |
Returns the hexadecimal value of the string.
Definition at line 509 of file String.php.
|
static |
Returns the TeamSpeak3_Helper_String based on a given hex value.
string |
TeamSpeak3_Helper_Exception |
Definition at line 528 of file String.php.
Referenced by TeamSpeak3_Node_Server\snapshotDeploy(), and TeamSpeak3_Adapter_Update\syn().
TeamSpeak3_Helper_String::transliterate | ( | ) |
Returns the string transliterated from UTF-8 to Latin.
Definition at line 550 of file String.php.
References toUtf8().
Referenced by uriSafe().
TeamSpeak3_Helper_String::uriSafe | ( | $spacer = "-" | ) |
Processes the string and replaces all accented UTF-8 characters by unaccented ASCII-7 "equivalents", whitespaces are replaced by a pre-defined spacer and the string is lowercase.
string | $spacer |
Definition at line 773 of file String.php.
References transliterate(), and trim().
TeamSpeak3_Helper_String::spaceToPercent | ( | ) |
Replaces space characters with percent encoded strings.
Definition at line 788 of file String.php.
TeamSpeak3_Helper_String::toString | ( | ) |
Returns the string as a standard string.
Definition at line 798 of file String.php.
TeamSpeak3_Helper_String::__call | ( | $function, | |
$args | |||
) |
Magical function that allows you to call PHP's built-in string functions on the TeamSpeak3_Helper_String object.
string | $function | |
array | $args |
TeamSpeak3_Helper_Exception |
Definition at line 811 of file String.php.
References count().
TeamSpeak3_Helper_String::__toString | ( | ) |
Returns the character as a standard string.
Definition at line 853 of file String.php.
TeamSpeak3_Helper_String::count | ( | ) |
TeamSpeak3_Helper_String::rewind | ( | ) |
Definition at line 869 of file String.php.
TeamSpeak3_Helper_String::valid | ( | ) |
Definition at line 877 of file String.php.
References count().
TeamSpeak3_Helper_String::key | ( | ) |
TeamSpeak3_Helper_String::current | ( | ) |
Definition at line 893 of file String.php.
TeamSpeak3_Helper_String::next | ( | ) |
Definition at line 901 of file String.php.
TeamSpeak3_Helper_String::offsetExists | ( | $offset | ) |
Definition at line 909 of file String.php.
Referenced by offsetGet(), offsetSet(), and offsetUnset().
TeamSpeak3_Helper_String::offsetGet | ( | $offset | ) |
TeamSpeak3_Helper_String::offsetSet | ( | $offset, | |
$value | |||
) |
Definition at line 925 of file String.php.
References offsetExists().
TeamSpeak3_Helper_String::offsetUnset | ( | $offset | ) |
Definition at line 935 of file String.php.
References offsetExists().
|
protected |
Definition at line 44 of file String.php.
Referenced by key().