Skip to content

Commit 02b4cd6

Browse files
update
1 parent 1723eff commit 02b4cd6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Str.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,17 @@ static public function reverse(string $value)
789789
return strrev($value);
790790
}
791791

792+
/**
793+
* Count the length of a string|array
794+
*
795+
* @param string|array $value
796+
* @return int
797+
*/
798+
static public function count($value)
799+
{
800+
return is_array($value) ? count($value) : self::trim(strlen($value));
801+
}
802+
792803
/**
793804
* Count the occurrences of a substring in a string.
794805
*

Tame.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static public function stringHash($string = null, $length = 100, $type = 'sha256
714714
static public function shortenString($string = null, $limit = 50, $replacer = '...')
715715
{
716716
// clean string before begin
717-
$string = strip_tags($string);
717+
$string = strip_tags(Str::trim($string));
718718
$string = str_replace("", '', $string);
719719
$string = Str::trim(str_replace(PHP_EOL, ' ', $string));
720720

0 commit comments

Comments
 (0)