From: Vincent Vanwaelscappel Date: Mon, 18 Sep 2023 14:09:04 +0000 (+0200) Subject: wait #6286 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e30cfcddbe7d80c30bed367a8fd370defcafe0ff;p=cubist_util.git wait #6286 @0.5 --- diff --git a/src/Text.php b/src/Text.php index c90d0a5..dc0e149 100644 --- a/src/Text.php +++ b/src/Text.php @@ -283,7 +283,7 @@ class Text $str = self::deaccent($str); $str = preg_replace('/[^A-Za-z0-9_\s\'\:\/[\]-]/', '', $str); - return self::tidyURL($str, true,false); + return self::tidyURL($str, true, false); } @@ -948,4 +948,27 @@ class Text return $res; } + /** + * @param $sep string + * @param $str string + * @param $trim string + * @return array + */ + public static function trimExplode($sep, $str, $trim = "\n\r\n\0\x0B") + { + $str = trim($str, $trim); + if (!$str) { + return []; + } + $res = []; + $e = explode($sep, $str); + foreach ($e as $v) { + $v = trim($v, $trim); + if ($v) { + $res[] = $v; + } + } + return $res; + } + } \ No newline at end of file