diff --git a/system/functions.php b/system/functions.php index 04aa2584..b170b63b 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1445,6 +1445,14 @@ function between($x, $lim1, $lim2) { return (($x >= $lower) && ($x <= $upper)); } +function truncate($string, $length) +{ + if (strlen($string) > $length) { + $string = substr($string, 0, $length) . '...'; + } + return $string; +} + // validator functions require_once LIBS . 'validator.php'; require_once SYSTEM . 'compat.php';