Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768055
D1628.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
806 B
Referenced Files
None
Subscribers
None
D1628.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 05:53 (10 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259580
Default Alt Text
D1628.diff (806 B)
Attached To
Mode
D1628: Add OmniString::len() method
Attached
Detach File
Event Timeline
Log In to Comment