Wrapper For ucfirst()

This will catch various case-able Unicode beyond the native PHP
functions.

@param string $str String.
@param bool $strict Strict.
@return void Nothing.
199323
public static function ucfirst(&$str, bool $strict=false) {
		if (\is_array($str)) {
			foreach ($str as $k=>$v) {
				static::ucfirst($str[$k], $strict);
			}
		}
		elseif (! $strict || \is_string($str)) {
			cast::string($str, true);

			if ($str) {
				if (
					\function_exists('mb_substr') &&
					(
						! \function_exists('mb_check_encoding') ||
						! \mb_check_encoding($str, 'ASCII')
					)
				) {
					$first = v_mb::substr($str, 0, 1);
					static::strtoupper($first, false);
					$str = $first . v_mb::substr($str, 1, null);
				}
				else {
					$str = \ucfirst($str);
				}
			}
		}
	}
293827
public function ucwords($str, $encoding = null)
	{
		$encoding or $encoding = $this->encoding;

		return function_exists('mb_convert_case')
			? mb_convert_case($str, MB_CASE_TITLE, $encoding)
			: ucwords(strtolower($str));
	}
4657
public static function lowerCaseFirst($str, $encoding = null)
    {
        return (string) Stringy::create($str, $encoding)->lowerCaseFirst();
    }
661342
static public function toCamel($str, $capitalise_first_char = false) {
      if($capitalise_first_char) {
        $str[0] = strtoupper($str[0]);
      }
      return preg_replace_callback('/_([a-z])/',function($char) {return strtoupper($char[1]);}, $str);
  }
336224
public function safeString($str, $strict = false, $extrachars = '')
    {
        return Str::makeSafe($str, $strict, $extrachars);
    }
516665
protected function setWebAppPrefix($str): void
    {
        $type = gettype($str);
        if (! is_string($str)) {
            throw StrictTypeException::cstrTypeError($str, 'WebApp Prefix');
        }
        $str = strtoupper(trim($str));
        if (strlen($str) < 3) {
            throw InvalidArgumentException::webappPrefixTooShort($str);
        }
        if (strlen($str) > 32) {
            throw InvalidArgumentException::webappPrefixTooLong($str);
        }
        if (preg_match('/[^A-Z0-9]/', $str) !== 0) {
            throw InvalidArgumentException::webappPrefixNotAlphaNumeric($str);
        }
        $this->webappPrefix = $str . '_';
    }
1229882
public function upper($str, $encoding = null)
	{
		$encoding or $encoding = $this->encoding;

		return function_exists('mb_strtoupper')
			? mb_strtoupper($str, $encoding)
			: strtoupper($str);
	}
1015809
protected void init(String str) {
	int len = str.length();
	text = new char[len];
	lcText = new char[len];

	for (int i = 0; i < len; i++) {
	    char c = str.charAt(i);
	    text[i] = c;
	    if (c == '\n' || c == '\r' || c == '\t') {
		lcText[i] = ' ';
	    }
	    else lcText[i] = ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) ? c : Character.toLowerCase(c);
	}
    }
775488
protected function unserialize($str)
    {
        $str  = str_replace("'", '"', $str);
        $data = @unserialize($str);
        if ($str === 'b:0;' || $data !== false) {
            return $data;
        }
        return false;
    }
85696
public function strDash($str, $camelFirst = true)
    {
        if ($camelFirst) {
            $str = StrUtil::camel($str);
        }
        return StrUtil::dash($str);
    }
722710
public static function ensureUTF8($str) {
		if($str == NULL) {
			return NULL;
		}
		$enc = mb_detect_encoding($str, array('ISO-8859-1', 'ISO-8859-15', 'UTF-8', 'ASCII'));
		if($enc !== FALSE) {
			if($enc == 'ISO-8859-1' || $enc == 'ISO-8859-15') {
				$str = mb_convert_encoding($str, 'UTF-8', $enc);
			}
		}
		return $str;
	}
542758
protected function _rfc822ParseAtomOrDot(&$str)
    {
        while ($this->_ptr < $this->_datalen) {
            $chr = $this->_data[$this->_ptr];
            if (($chr != '.') &&
                /* TODO: Optimize by duplicating rfc822IsAtext code here */
                !$this->_rfc822IsAtext($chr, ',<:')) {
                $this->_rfc822SkipLwsp();
                if (!$this->_params['validate']) {
                    $str = trim($str);
                }
                return;
            }

            $str .= $chr;
            ++$this->_ptr;
        }
    }
724919
public function indexOf($value, bool $strict = false): int
    {
        $r = $this->search($value, $strict);

        return (int) ($r === false ? -1 : $r);
    }
608795
public function match(Parser $parser, $uri, $params = array(), $strict = false)
    {
        // match literal string from start to end
        $length = strlen($this->token);
        if (substr($uri, 0, $length) === $this->token) {
            $uri = substr($uri, $length);
        }

        // when there's no match, just return null if strict mode is given
        else if ($strict) {
            return null;
        }

        return array($uri, $params);
    }
1149417
public static function ucFirst($str)
    {
        if (self::$use_mbstring) {
            $first = self::toUpper(self::sub($str, 0, 1));
            $str   = $first . self::sub($str, 1);
        } else {
            $str   = ucfirst($str);
        }
        
        return $str;
    }
934819
public static function camelize($str)
    {
        $str = strtolower($str);
        $str = strtr($str, '_', ' ');
        $str = preg_replace('/\s+/', '', ucwords($str));

        return lcfirst($str);
    }
457220
function ucwordbreaks( $str ) {
		if ( $this->isMultibyte( $str ) ) {
			$str = $this->lc( $str );

			// since \b doesn't work for UTF-8, we explicitely define word break chars
			$breaks = "[ \-\(\)\}\{\.,\?!]";

			// find first letter after word break
			$replaceRegexp = "/^([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)|$breaks([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)/";

			if ( function_exists( 'mb_strtoupper' ) ) {
				return preg_replace_callback(
					$replaceRegexp,
					array( $this, 'ucwordbreaksCallbackMB' ),
					$str
				);
			} else {
				return preg_replace_callback(
					$replaceRegexp,
					array( $this, 'ucwordsCallbackWiki' ),
					$str
				);
			}
		} else {
			return preg_replace_callback(
				'/\b([\w\x80-\xff]+)\b/',
				array( $this, 'ucwordbreaksCallbackAscii' ),
				$str
			);
		}
	}