Loading src/UnicaenApp/Util.php +11 −2 Changes for src/UnicaenApp/Util.php: 11 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -338,11 +338,20 @@ class Util if (strlen($string) <= $length) { return $string; } $trunc = substr($string, 0, $length); if ($string[$length] === ' ') { return substr($string, 0, $length) . $appended; $kept = $trunc; } else { $found = strrpos($trunc, ' '); // position du dernier espace if ($found === false) { $kept = $trunc; } else { $kept = substr($string, 0, $found); // on tronque à l'espace trouvé } } return substr($string, 0, strrpos(substr($string, 0, $length), ' ')) . $appended; return $kept . $appended; } Loading Loading
src/UnicaenApp/Util.php +11 −2 Changes for src/UnicaenApp/Util.php: 11 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -338,11 +338,20 @@ class Util if (strlen($string) <= $length) { return $string; } $trunc = substr($string, 0, $length); if ($string[$length] === ' ') { return substr($string, 0, $length) . $appended; $kept = $trunc; } else { $found = strrpos($trunc, ' '); // position du dernier espace if ($found === false) { $kept = $trunc; } else { $kept = substr($string, 0, $found); // on tronque à l'espace trouvé } } return substr($string, 0, strrpos(substr($string, 0, $length), ' ')) . $appended; return $kept . $appended; } Loading