Add Str::chunk()

This commit is contained in:
Giuseppe Criscione 2022-11-19 23:51:27 +01:00
parent 64d804ca60
commit 55d06098a2

View File

@ -178,4 +178,13 @@ class Str
$string
);
}
/**
* Split a string in chunks of given length with a delimiter
*/
public static function chunk(string $string, string $length, string $delimiter): string
{
return implode($delimiter, str_split($string, $length));
}
}