Truncate help add method and suffix (#19425)

https://github.com/yiisoft/yii2/pull/19424
This commit is contained in:
Basil
2022-06-02 11:46:06 +02:00
committed by GitHub
parent e21cbb544b
commit 1f59b72a9d

View File

@ -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.