Skip to content

Commit 5d96499

Browse files
committed
Stringer 1.1.4
1 parent a64033f commit 5d96499

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Includes the following helpers:
1818
- [Servery](https://github.com/nabeghe/servery-php) <small>v0.2.2</small>
1919
- [Shortnum](https://github.com/nabeghe/shortnum-php) <small>v1.0.0</small>
2020
- [SimpleCipher](https://github.com/nabeghe/simple-cipher-php) <small>v1.0.0</small>
21-
- [Stringer](https://github.com/nabeghe/stringer-php) <small>v1.1.3</small>
21+
- [Stringer](https://github.com/nabeghe/stringer-php) <small>v1.1.4</small>
2222
- [Tepade](https://github.com/nabeghe/tepade-php) <small>v1.0.0</small>
2323
- [Traituctor](https://github.com/nabeghe/traituctor) <small>v0.1.1</small>
2424
- [Yielder](https://github.com/nabeghe/yielder-php) <small>v1.0.0</small>

composer.lock

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stringer/Str.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,17 +748,24 @@ public static function kebab($value)
748748

749749
/**
750750
* Return the length of the given string.
751+
*
751752
* @param string $value
752753
* @param string|null $encoding
753754
* @param bool $emojible
754755
* @return int
755756
*/
756757
public static function len($value, $encoding = 'UTF-8', $emojible = true)
757758
{
758-
if ($emojible) {
759+
if ($value == '') {
760+
return 0;
761+
}
762+
763+
if ($emojible && $value) {
759764
$value = preg_replace('/\p{M}/u', '', $value);
760765
}
766+
761767
return mb_strlen($value, $encoding);
768+
762769
//$length = 0;
763770
//$valuelength = \strlen($value);
764771
//for ($x = 0; $x < $valuelength; $x++) {

0 commit comments

Comments
 (0)