@@ -129,9 +129,9 @@ public static function toTyped(string $str, bool $parseBool = false, int $intMax
129
129
*
130
130
* @return array
131
131
*/
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
133
133
{
134
- return self ::str2ints ($ string , $ delimiter , $ limit );
134
+ return self ::toInts ($ string , $ delimiter , $ limit );
135
135
}
136
136
137
137
/**
@@ -141,7 +141,7 @@ public static function toInts(string $string, string $delimiter = ',', int $limi
141
141
*
142
142
* @return array
143
143
*/
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
145
145
{
146
146
$ intArr = [];
147
147
// $values = self::splitTrimFiltered($str, $delimiter, $limit);
@@ -394,6 +394,16 @@ public static function splitByWidth(string $string, int $width = 1): array
394
394
return $ lines ;
395
395
}
396
396
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
+
397
407
/**
398
408
* @param string $str
399
409
* @param int $length
@@ -425,7 +435,7 @@ public static function splitUnicode(string $str, int $length = 1): array
425
435
*/
426
436
public static function splitUnicode2 (string $ str , int $ length = 1 ): array
427
437
{
428
- $ tmp = preg_split ('~~ u ' , $ str , -1 , PREG_SPLIT_NO_EMPTY );
438
+ $ tmp = preg_split ('// u ' , $ str , -1 , PREG_SPLIT_NO_EMPTY );
429
439
430
440
if ($ length > 1 ) {
431
441
$ chunks = array_chunk ($ tmp , $ length );
0 commit comments