Make docs more clear about the length of the result (#19424)

This commit is contained in:
Basil
2022-06-02 11:26:40 +02:00
committed by GitHub
parent 4d0d25d479
commit e21cbb544b

View File

@ -108,6 +108,10 @@ 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.
*
* @param string $string The string to truncate.
* @param int $length How many characters from original string to include into truncated string.
* @param string $suffix String to append to the end of truncated string.