getLength(); } /** * Necessary to comply with the ArrayAccess interface. * * @internal */ public function offsetSet(mixed $offset, mixed $value): void { throw new BadMethodCallException('Strings are immutable.'); } /** * Necessary to comply with the ArrayAccess interface. * * @internal */ public function offsetUnset(mixed $offset): void { throw new BadMethodCallException('Strings are immutable.'); } public function toBool(): bool { return XString::toBool($this); } public function toInt(int $base = 10): int { return XString::toInt($this, $base); } public function toFloat(): float { return XString::toFloat($this); } public function escape( int $flags = ENT_COMPAT | ENT_HTML5, ?string $encoding = null, bool $doubleEncoding = true ): IString { return new AString(XString::escape($this, $flags, $encoding, $doubleEncoding)); } }