| @@ 262-271 (lines=10) @@ | ||
| 259 | */ |
|
| 260 | public function cspn(string $mask, int $start = 0, int $length = null): int |
|
| 261 | { |
|
| 262 | if ($length === null) { |
|
| 263 | $value = strcspn($this->value, $mask, $start); |
|
| 264 | } else { |
|
| 265 | $value = strcspn( |
|
| 266 | $this->value, |
|
| 267 | $mask, |
|
| 268 | $start, |
|
| 269 | $length |
|
| 270 | ); |
|
| 271 | } |
|
| 272 | ||
| 273 | return (int) $value; |
|
| 274 | } |
|
| @@ 470-474 (lines=5) @@ | ||
| 467 | */ |
|
| 468 | public function substring(int $start, int $length = null): self |
|
| 469 | { |
|
| 470 | if ($length === null) { |
|
| 471 | $sub = substr($this->value, $start); |
|
| 472 | } else { |
|
| 473 | $sub = substr($this->value, $start, $length); |
|
| 474 | } |
|
| 475 | ||
| 476 | return new self($sub); |
|
| 477 | } |
|