public static function pop(string &$str, string $encoding = null)
    {
        $encoding = $encoding ?: mb_internal_encoding();

        $last = mb_substr($str, -1, null, $encoding);
        $str = mb_substr($str, 0, -1, $encoding);

        return $last;
    }