芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/vendor/azjezz/psl/src/Psl/Str/split.php
* * @pure */ function split(string $string, string $delimiter, ?int $limit = null, Encoding $encoding = Encoding::UTF_8): array { if ('' === $delimiter) { if (null === $limit || $limit >= length($string, $encoding)) { return chunk($string, 1, $encoding); } if (1 === $limit) { return [$string]; } $length = $limit - 1; $result = chunk(slice($string, 0, $length, $encoding), 1, $encoding); $result[] = slice($string, $length, null, $encoding); return $result; } $limit ??= Math\INT64_MAX; $tail = $string; $chunks = []; /** * $offset is within bounded. * * @psalm-suppress MissingThrowsDocblock */ $position = search($tail, $delimiter, 0, $encoding); while (1 < $limit && null !== $position) { $result = slice($tail, 0, $position, $encoding); $chunks[] = $result; $tail = slice($tail, length($result, $encoding) + length($delimiter, $encoding), null, $encoding); $limit--; /** * $offset is within bounded. * * @psalm-suppress MissingThrowsDocblock */ $position = search($tail, $delimiter, encoding: $encoding); } $chunks[] = $tail; return $chunks; }