From 0998ec60059fc13eb20406522ba032ae29994104 Mon Sep 17 00:00:00 2001 From: Basil Date: Thu, 2 Jun 2022 10:19:48 +0200 Subject: [PATCH] Make docs more clear about the length of the result --- framework/helpers/BaseStringHelper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/helpers/BaseStringHelper.php b/framework/helpers/BaseStringHelper.php index e8b3f02666e..90e593e3e8c 100644 --- a/framework/helpers/BaseStringHelper.php +++ b/framework/helpers/BaseStringHelper.php @@ -108,6 +108,10 @@ public static function dirname($path) /** * 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.