3 //class String implements ArrayAccess, Countable, ByteArrayConvertable {
7 // function __construct($data) {
8 // $this->source = $data;
9 // $this->data = str_split($data, 1);
12 // function offsetExists($offset) {
13 // return isset($this->data[$offset]);
16 // function __toString() {
17 // return implode('', $this->data);
20 // function offsetGet($offset) {
21 // return $this->data[$offset];
24 // function offsetSet($offset, $value) {
25 // if (is_int($value)) $value = chr($value);
26 // if (is_string($value."")) {
27 // if (strlen($value) > 1) {
28 // $arr = str_split($value, 1);
31 // $this->data[$offset] = value;
35 // function offsetUnset($offset) {
36 // unset($this->data[$offset]);
37 // $this->data = array_values($this->data);
40 // function change($subject, $replacement) {
41 // $str = str_replace($subject, $replacement, $this->__toString());
42 // $this->data = str_split($str, 1);
45 // function replace($regexp, $replacement, $limit = NULL, &$count = NULL) {
46 // $str = $this->__toString();
47 // $str = preg_replace($regexp, $replacement, $str, $limit, $count);
48 // $this->data = str_split($str, 1);
52 // return count($this->data);
55 // function length() {
56 // return count($this->data);
59 // function toBytesArray() {
61 // for($x=0; $x<$this->length(); $x++) {
62 // $ret[] = ord($this->data[$x]);
67 // function toByteArray() {
68 // return new ByteArray($this->toBytesArray);
71 // function fromByteArray(ByteArray $array) {
72 // $this->data = array();
73 // for($x=0; $x < count($array); $x++) {
74 // $this->data[] = chr($array[$x]);