Helper class for char handling.
More...
|
| | __construct ($char) |
| | The TeamSpeak3_Helper_Char constructor.
|
| |
| | isLetter () |
| | Returns true if the character is a letter.
|
| |
| | isDigit () |
| | Returns true if the character is a decimal digit.
|
| |
| | isSpace () |
| | Returns true if the character is a space.
|
| |
| | isMark () |
| | Returns true if the character is a mark.
|
| |
| | isControl () |
| | Returns true if the character is a control character (i.e.
|
| |
| | isPrintable () |
| | Returns true if the character is a printable character.
|
| |
| | isNull () |
| | Returns true if the character is the Unicode character 0x0000 ("\0").
|
| |
| | isUpper () |
| | Returns true if the character is an uppercase letter.
|
| |
| | isLower () |
| | Returns true if the character is a lowercase letter.
|
| |
| | toUpper () |
| | Returns the uppercase equivalent if the character is lowercase.
|
| |
| | toLower () |
| | Returns the lowercase equivalent if the character is uppercase.
|
| |
| | toAscii () |
| | Returns the ascii value of the character.
|
| |
| | toUnicode () |
| | Returns the Unicode value of the character.
|
| |
| | toHex () |
| | Returns the hexadecimal value of the char.
|
| |
| | toString () |
| | Returns the character as a standard string.
|
| |
| | toInt () |
| | Returns the integer value of the character.
|
| |
| | __toString () |
| | Returns the character as a standard string.
|
| |
Helper class for char handling.
Definition at line 32 of file Char.php.
| TeamSpeak3_Helper_Char::__construct |
( |
|
$char | ) |
|
| TeamSpeak3_Helper_Char::isLetter |
( |
| ) |
|
Returns true if the character is a letter.
- Returns
- boolean
Definition at line 63 of file Char.php.
{
return ctype_alpha($this->char);
}
| TeamSpeak3_Helper_Char::isDigit |
( |
| ) |
|
Returns true if the character is a decimal digit.
- Returns
- boolean
Definition at line 73 of file Char.php.
{
return ctype_digit($this->char);
}
| TeamSpeak3_Helper_Char::isSpace |
( |
| ) |
|
Returns true if the character is a space.
- Returns
- boolean
Definition at line 83 of file Char.php.
{
return ctype_space($this->char);
}
| TeamSpeak3_Helper_Char::isMark |
( |
| ) |
|
Returns true if the character is a mark.
- Returns
- boolean
Definition at line 93 of file Char.php.
{
return ctype_punct($this->char);
}
| TeamSpeak3_Helper_Char::isControl |
( |
| ) |
|
Returns true if the character is a control character (i.e.
"\t").
- Returns
- boolean
Definition at line 103 of file Char.php.
{
return ctype_cntrl($this->char);
}
| TeamSpeak3_Helper_Char::isPrintable |
( |
| ) |
|
Returns true if the character is a printable character.
- Returns
- boolean
Definition at line 113 of file Char.php.
{
return ctype_print($this->char);
}
| TeamSpeak3_Helper_Char::isNull |
( |
| ) |
|
Returns true if the character is the Unicode character 0x0000 ("\0").
- Returns
- boolean
Definition at line 123 of file Char.php.
{
return ($this->char === "\0") ? TRUE : FALSE;
}
| TeamSpeak3_Helper_Char::isUpper |
( |
| ) |
|
Returns true if the character is an uppercase letter.
- Returns
- boolean
Definition at line 133 of file Char.php.
Referenced by toUpper().
{
return ($this->char === strtoupper($this->char)) ? TRUE : FALSE;
}
| TeamSpeak3_Helper_Char::isLower |
( |
| ) |
|
Returns true if the character is a lowercase letter.
- Returns
- boolean
Definition at line 143 of file Char.php.
Referenced by toLower().
{
return ($this->char === strtolower($this->char)) ? TRUE : FALSE;
}
| TeamSpeak3_Helper_Char::toUpper |
( |
| ) |
|
| TeamSpeak3_Helper_Char::toLower |
( |
| ) |
|
| TeamSpeak3_Helper_Char::toAscii |
( |
| ) |
|
Returns the ascii value of the character.
- Returns
- integer
Definition at line 173 of file Char.php.
Referenced by toHex().
{
return ord($this->char);
}
| TeamSpeak3_Helper_Char::toUnicode |
( |
| ) |
|
Returns the Unicode value of the character.
- Returns
- integer
Definition at line 183 of file Char.php.
{
$h = ord($this->char{0});
if($h <= 0x7F)
{
return $h;
}
else if($h < 0xC2)
{
return FALSE;
}
else if($h <= 0xDF)
{
return ($h & 0x1F) << 6 | (ord($this->char{1}) & 0x3F);
}
else if($h <= 0xEF)
{
return ($h & 0x0F) << 12 | (ord($this->char{1}) & 0x3F) << 6 | (ord($this->char{2}) & 0x3F);
}
else if($h <= 0xF4)
{
return ($h & 0x0F) << 18 | (ord($this->char{1}) & 0x3F) << 12 | (ord($this->char{2}) & 0x3F) << 6 | (ord($this->char{3}) & 0x3F);
}
else
{
return FALSE;
}
}
| TeamSpeak3_Helper_Char::toHex |
( |
| ) |
|
Returns the hexadecimal value of the char.
- Returns
- string
Definition at line 218 of file Char.php.
References toAscii().
{
return strtoupper(dechex($this->
toAscii()));
}
| static TeamSpeak3_Helper_Char::fromHex |
( |
|
$hex | ) |
|
|
static |
| TeamSpeak3_Helper_Char::toString |
( |
| ) |
|
Returns the character as a standard string.
- Returns
- string
Definition at line 245 of file Char.php.
| TeamSpeak3_Helper_Char::toInt |
( |
| ) |
|
Returns the integer value of the character.
- Returns
- integer
Definition at line 255 of file Char.php.
{
return intval($this->char);
}
| TeamSpeak3_Helper_Char::__toString |
( |
| ) |
|
Returns the character as a standard string.
- Returns
- string
Definition at line 265 of file Char.php.
The documentation for this class was generated from the following file: