mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 14:28:27 +08:00
Truncate help add method and suffix (#19425)
https://github.com/yiisoft/yii2/pull/19424
This commit is contained in:
@ -109,8 +109,8 @@ class BaseStringHelper
|
||||
* Truncates a string to the number of characters specified.
|
||||
*
|
||||
* In order to truncate for an exact length, the $suffix char length must be counted towards the $length. For example
|
||||
* to have a string which is exactly 255 long with $suffix `...` then `StringHelper::($string, 252)` must be used to ensure
|
||||
* you have 255 long string afterwards.
|
||||
* to have a string which is exactly 255 long with $suffix `...` of 3 chars, then `StringHelper::truncate($string, 252, '...')`
|
||||
* must be used to ensure you have 255 long string afterwards.
|
||||
*
|
||||
* @param string $string The string to truncate.
|
||||
* @param int $length How many characters from original string to include into truncated string.
|
||||
|
Reference in New Issue
Block a user