summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/utils/StringUtils.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/mystic/forum/utils/StringUtils.php')
-rw-r--r--src/application/mystic/forum/utils/StringUtils.php4
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);
+ }
}