|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
Interface for a text wrapper that makes it easier to manipulate text. More...
Inheritance diagram for Erebot\Interfaces\TextWrapper:Public Member Functions | |
| __toString () | |
| countTokens ($separator= ' ') | |
| getTokens ($start, $length=0, $separator= ' ') | |
Public Member Functions inherited from Countable | |
| count () | |
Public Member Functions inherited from ArrayAccess | |
| offsetExists ($offset) | |
| offsetGet ($offset) | |
| offsetSet ($offset, $value) | |
| offsetUnset ($offset) | |
Public Member Functions inherited from Iterator | |
| current () | |
| key () | |
| next () | |
| rewind () | |
| valid () | |
Interface for a text wrapper that makes it easier to manipulate text.
Definition at line 28 of file TextWrapper.php.
| Erebot\Interfaces\TextWrapper::__toString | ( | ) |
Returns the wrapped text (untouched).
| string | The text wrapped by this instance. |
Implemented in Erebot\TextWrapper.
| Erebot\Interfaces\TextWrapper::countTokens | ( | $separator = ' ' | ) |
Returns the number of chunks (tokens) obtained by splitting the wrapped text using the given separator. Whitespaces are squeezed together in the process, no matter what separator is actually used.
| null | string | $separator | (optional) The separator to use while splitting the text. The default is to split it on whitespaces (' '). |
| int | The number of tokens in the string. |
Implemented in Erebot\TextWrapper.
| Erebot\Interfaces\TextWrapper::getTokens | ( | $start, | |
$length = 0, |
|||
$separator = ' ' |
|||
| ) |
Splits the wrapped text using the given separator and returns only some of the chunks (tokens) as a new string. Whitespaces are squeezed together in the process, no matter what separator is actually used.
| int | $start | Offset of the first chunk to return (starting at 0). If negative, it starts at the end of the wrapped text. |
| null | int | $length | (optional) Number of chunks to return in the new string. If set to 0 (the default), returns all chunks from $start onward until the end of the wrapped text. |
| null | string | $separator | (optional) The separator to use while splitting the text. The default is to split it on whitespaces (' '). |
| string | At most $length chunks (if $length > 0) and its whitespaces squeezed. |
Implemented in Erebot\TextWrapper.