Location: PHPKode > projects > Mocovie web framework > mocovi/library/autoload/String.php
<?php
class_exists('EventHandler')	or require $GLOBALS['library'].'autoload/EventHandler.php';

class String implements Iterator
{
	protected $buffer = '';
	protected $position = 0;

	public function __construct($string = '') {$this->buffer = (String)$string;}
	public function __destruct() {$this->clear();}
	public function __toString() {EventHandler::triggerEvent('write', $this);return $this->buffer;}
	public function __set($name, $value) {$this->buffer = (String)$value;}

	public function append($string) {$this->buffer .= (String)$string;return $this;}
	public function prepend($string) {$this->buffer = (String)$string.$this->buffer;return $this;}
	/* unused
	public function uppercase() {$this->buffer = strToUpper($this->buffer);return $this;}
	public function lowercase() {$this->buffer = strToLower($this->buffer);return $this;}
	public function toInteger() {return $this->toInt();} // Alias for toInt();
	public function toInt() {return (int)$this->buffer;}
	public function toBoolean() {return $this->toBool();} // Alias for ToBool();
	public function toBool() {return (boolean)$this->buffer;}
	public function length() {return strlen($this->buffer);}
	public function substring($start, $length = NULL) {return new String(substr($this->buffer, $start, $length ? $length : $this->length() - $start));}
	*/
	public  function clear() {$this->buffer = '';}

	/* Iterator methods */
	public function rewind() {$this->position = 0;}
	public function valid() {return $this->position < strlen($this->buffer);}
	public function key() {return $this->position;}
	public function current() {return $this->buffer[$this->position];}
	public function next() {$this->position++;}
}
Return current item: Mocovie web framework