Page MenuHomeDevCentral

D1628.diff
No OneTemporary

D1628.diff

diff --git a/src/Strings/Multibyte/OmniString.php b/src/Strings/Multibyte/OmniString.php
--- a/src/Strings/Multibyte/OmniString.php
+++ b/src/Strings/Multibyte/OmniString.php
@@ -59,6 +59,10 @@
return StringUtilities::endsWith($this->value, $end);
}
+ public function len () : int {
+ return mb_strlen($this->value, $this->encoding);
+ }
+
/**
* @return string
*/
diff --git a/tests/Strings/Multibyte/OmniStringTest.php b/tests/Strings/Multibyte/OmniStringTest.php
--- a/tests/Strings/Multibyte/OmniStringTest.php
+++ b/tests/Strings/Multibyte/OmniStringTest.php
@@ -45,4 +45,8 @@
$this->assertFalse($this->string->endsWith("bar"));
}
+ public function testLen () : void {
+ $this->assertEquals(3, $this->string->len());
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 05:53 (8 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259580
Default Alt Text
D1628.diff (806 B)

Event Timeline