@@ 258-267 (lines=10) @@ | ||
255 | */ |
|
256 | public function cspn(string $mask, int $start = 0, int $length = null): int |
|
257 | { |
|
258 | if ($length === null) { |
|
259 | $value = strcspn($this->value, $mask, $start); |
|
260 | } else { |
|
261 | $value = strcspn( |
|
262 | $this->value, |
|
263 | $mask, |
|
264 | $start, |
|
265 | $length |
|
266 | ); |
|
267 | } |
|
268 | ||
269 | return (int) $value; |
|
270 | } |
|
@@ 466-470 (lines=5) @@ | ||
463 | */ |
|
464 | public function substring(int $start, int $length = null): self |
|
465 | { |
|
466 | if ($length === null) { |
|
467 | $sub = substr($this->value, $start); |
|
468 | } else { |
|
469 | $sub = substr($this->value, $start, $length); |
|
470 | } |
|
471 | ||
472 | return new self($sub); |
|
473 | } |