| @@ 367-379 (lines=13) @@ | ||
| 364 | * |
|
| 365 | * @return TypedCollectionInterface |
|
| 366 | */ |
|
| 367 | public function pregSplit(string $regex, int $limit = -1, int $flags = self::PREG_NO_FLAGS): TypedCollectionInterface |
|
| 368 | { |
|
| 369 | $strings = preg_split($regex, $this->value, $limit, $flags); |
|
| 370 | ||
| 371 | foreach ($strings as &$string) { |
|
| 372 | $string = new self($string); |
|
| 373 | } |
|
| 374 | ||
| 375 | return new TypedCollection( |
|
| 376 | self::class, |
|
| 377 | $strings |
|
| 378 | ); |
|
| 379 | } |
|
| 380 | ||
| 381 | /** |
|
| 382 | * Check if the string match the given regular expression |
|
| @@ 335-345 (lines=11) @@ | ||
| 332 | * |
|
| 333 | * @return StreamInterface<self> |
|
| 334 | */ |
|
| 335 | public function pregSplit(string $regex, int $limit = -1): StreamInterface |
|
| 336 | { |
|
| 337 | $strings = preg_split($regex, $this->value, $limit); |
|
| 338 | $stream = new Stream(self::class); |
|
| 339 | ||
| 340 | foreach ($strings as $string) { |
|
| 341 | $stream = $stream->add(new self($string)); |
|
| 342 | } |
|
| 343 | ||
| 344 | return $stream; |
|
| 345 | } |
|
| 346 | ||
| 347 | /** |
|
| 348 | * Check if the string match the given regular expression |
|