]> _ Git - cubist_util.git/commitdiff
wait #6286 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 18 Sep 2023 14:09:04 +0000 (16:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 18 Sep 2023 14:09:04 +0000 (16:09 +0200)
src/Text.php

index c90d0a58fdf8489be00d63c0db35a1c0f9d8cac2..dc0e149d6c0819bf438fade7eb116845f9ae6c4d 100644 (file)
@@ -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