This object is usefull for string conversion

package OWR
used_by \OWR\Stream\Parser
used_by \OWR\XML
used_by \OWR\OPML\Parser
used_by \OWR\View\Utilities
used_by \OWR\View\Block

 Methods

Multi-byte equivalent of php wordwrap() function WARNING : this method is NOT tag safe

mb_wordwrap(string $str, int $width, string $break, int $lines) : string
Static
author Pierre-Alain Mignot
access public
static

Parameters

$str

string

the string to wordwrap

$width

int

the width to cut

$break

string

on what character to break

$lines

int

maximum number of lines to return, optionnal

Returns

stringthe wordwraped string

Converts M$ chars to _normals_

toNormal(string $str) : string
Static
author Pierre-Alain Mignot
static

Parameters

$str

string

the string to convert

Returns

stringthe converted string

Converts HTML entities to XML

toXML(string $str, bool $reverse, bool $html) : string
Static
author Pierre-Alain Mignot
static

Parameters

$str

string

The string to convert

$reverse

bool

reverse XML entities to HTML

$html

bool

must-we htmlentitize the string ?

Returns

stringthe converted string

Truncates a string to the length of $length and replaces the last characters with the ending if the text is longer than length.

truncate(string $text, integer $length, array $options) : string
Static

Checked out from CakePHP Framework, many thanks to them.

Options:

  • ending Will be used as Ending and appended to the trimmed string
  • exact If false, $text will not be cut mid-word
  • html If true, HTML tags would be handled correctly
access public
static
link http://book.cakephp.org/view/1469/Text#truncate-1625

Parameters

$text

string

String to truncate.

$length

integer

Length of returned string, including ellipsis.

$options

array

An array of html attributes and options.

Returns

stringTruncated string.