<?php
declare(strict_types=1);

namespace App\Framework\Core\Helper;

use Stringable;

final readonly class Str
{
    public static function len(Stringable|string $value): int
    {
        #grapheme_strlen($value);
        return mb_strlen((string)$value);
    }

    public static function empty(Stringable|string $value): bool
    {
        return self::len($value) === 0;
    }

    public static function slice(Stringable|string $value, int $start, ?int $length = null): string
    {
        return grapheme_substr((string)$value, $start, $length);
    }

    public static function trim(Stringable|string $value): string
    {
        return mb_trim((string)$value);
    }

    /**
     * ltrim
     * rtrim
     * ucfirst
     * lcfirst
     * upper
     * lower
     */
}
