diff --git a/doc/class-apemsel.AttributedString.AttributedString.html b/doc/class-apemsel.AttributedString.AttributedString.html index 8d3d0f9..97bc5ac 100644 --- a/doc/class-apemsel.AttributedString.AttributedString.html +++ b/doc/class-apemsel.AttributedString.AttributedString.html @@ -1185,7 +1185,7 @@

Implementation of

protected - + array @@ -1203,7 +1203,7 @@

Implementation of

# - + []
diff --git a/doc/class-apemsel.AttributedString.MutableAttributedString.html b/doc/class-apemsel.AttributedString.MutableAttributedString.html index 3099be3..c069729 100644 --- a/doc/class-apemsel.AttributedString.MutableAttributedString.html +++ b/doc/class-apemsel.AttributedString.MutableAttributedString.html @@ -126,7 +126,7 @@

Class MutableAttributedString

Author: Adrian Pemsel apemsel@gmail.com
- Located at MutableAttributedString.php + Located at MutableAttributedString.php
@@ -255,6 +255,88 @@

See

+ + + + public + + + + + +
+ # + offsetSet( integer $offset, $value ) + +
+

Replace char at given offset

+
+ + +
+ + + + + public + + + + + +
+ # + offsetUnset( integer $offset ) + +
+

Unset char at given offset

+
+ + +
+ @@ -278,8 +360,6 @@

See

is(), offsetExists(), offsetGet(), - offsetSet(), - offsetUnset(), searchAttribute(), setLength(), setPattern(), diff --git a/doc/source-class-apemsel.AttributedString.AttributedString.html b/doc/source-class-apemsel.AttributedString.AttributedString.html index 8b0a2d7..700fb82 100644 --- a/doc/source-class-apemsel.AttributedString.AttributedString.html +++ b/doc/source-class-apemsel.AttributedString.AttributedString.html @@ -95,7 +95,7 @@

Classes

11 class AttributedString implements \Countable, \ArrayAccess 12 { 13 protected $string; - 14 protected $attributes; + 14 protected $attributes = []; 15 protected $length; 16 protected $byteToChar; 17 diff --git a/doc/source-class-apemsel.AttributedString.MutableAttributedString.html b/doc/source-class-apemsel.AttributedString.MutableAttributedString.html index ca49c77..5b54dd1 100644 --- a/doc/source-class-apemsel.AttributedString.MutableAttributedString.html +++ b/doc/source-class-apemsel.AttributedString.MutableAttributedString.html @@ -135,8 +135,8 @@

Classes

51 */ 52 public function delete($pos, $length) { 53 $leftPart = ""; - 54 if ($pos > 0) { - 55 $leftPart = mb_substr($this->string, 0, $pos - 1, "utf-8"); + 54 if ($pos >= 0) { + 55 $leftPart = mb_substr($this->string, 0, $pos, "utf-8"); 56 } 57 58 $rightPart = ""; @@ -197,8 +197,28 @@

Classes

113 114 return join($smatches[0]); 115 } -116 } -117 +116 +117 // Modified ArrayAccess interface +118 +119 /** +120 * Replace char at given offset +121 * +122 * @param int $offset offset +123 */ +124 public function offsetSet($offset, $value) { +125 $this->string = self::mb_substr_replace($this->string, $value, $offset, mb_strlen($value, "utf-8")); +126 } +127 +128 /** +129 * Unset char at given offset +130 * +131 * @param int $offset offset +132 */ +133 public function offsetUnset($offset) { +134 $this->delete($offset, 1); +135 } +136 } +137