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