@@ -129,9 +129,9 @@ public static function toTyped(string $str, bool $parseBool = false, int $intMax
129129 *
130130 * @return array
131131 */
132- public static function toInts (string $ string , string $ delimiter = ', ' , int $ limit = 0 ): array
132+ public static function str2ints (string $ string , string $ delimiter = ', ' , int $ limit = 0 ): array
133133 {
134- return self ::str2ints ($ string , $ delimiter , $ limit );
134+ return self ::toInts ($ string , $ delimiter , $ limit );
135135 }
136136
137137 /**
@@ -141,7 +141,7 @@ public static function toInts(string $string, string $delimiter = ',', int $limi
141141 *
142142 * @return array
143143 */
144- public static function str2ints (string $ str , string $ delimiter = ', ' , int $ limit = 0 ): array
144+ public static function toInts (string $ str , string $ delimiter = ', ' , int $ limit = 0 ): array
145145 {
146146 $ intArr = [];
147147 // $values = self::splitTrimFiltered($str, $delimiter, $limit);
@@ -394,6 +394,16 @@ public static function splitByWidth(string $string, int $width = 1): array
394394 return $ lines ;
395395 }
396396
397+ /**
398+ * @param string $str
399+ *
400+ * @return array
401+ */
402+ public static function splitUtf8 (string $ str ): array
403+ {
404+ return preg_split ('//u ' , $ str , -1 , PREG_SPLIT_NO_EMPTY );
405+ }
406+
397407 /**
398408 * @param string $str
399409 * @param int $length
@@ -425,7 +435,7 @@ public static function splitUnicode(string $str, int $length = 1): array
425435 */
426436 public static function splitUnicode2 (string $ str , int $ length = 1 ): array
427437 {
428- $ tmp = preg_split ('~~ u ' , $ str , -1 , PREG_SPLIT_NO_EMPTY );
438+ $ tmp = preg_split ('// u ' , $ str , -1 , PREG_SPLIT_NO_EMPTY );
429439
430440 if ($ length > 1 ) {
431441 $ chunks = array_chunk ($ tmp , $ length );
0 commit comments