diff options
Diffstat (limited to 'src/application/mystic/forum/utils/StringUtils.php')
-rw-r--r-- | src/application/mystic/forum/utils/StringUtils.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/application/mystic/forum/utils/StringUtils.php b/src/application/mystic/forum/utils/StringUtils.php index 7d4bf9d..fd38915 100644 --- a/src/application/mystic/forum/utils/StringUtils.php +++ b/src/application/mystic/forum/utils/StringUtils.php @@ -21,4 +21,8 @@ final class StringUtils { return ltrim($result, '_'); } + + public static function truncate(string $str, int $maxLength, string $ellipsis = "…"): string { + return mb_strimwidth($str, 0, $maxLength, $ellipsis); + } } |