From 8c06bd1738f5e8535c2ef331b8f98fbdc4794c9f Mon Sep 17 00:00:00 2001 From: Lee <42119604+Leesneaks@users.noreply.github.com> Date: Mon, 4 Jan 2021 12:42:13 +0000 Subject: [PATCH] function Truncate added missing function added to functions lib. --- system/functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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';