Capitalizes the first word of the string, replaces underscores with
spaces, and strips '_id'.

@return static Object with a humanized $str
344904
public function humanize()
	{
		trigger_error('Function not implemented yet');

		return static::create(
					str_replace(['_id', '_'], ['', ' '], $this->str),
					$this->encoding)->trim()->upperCaseFirst();
	}
256770
public function upperCaseFirst()
    {
        return $this->cloneInstance(
            function (StringObject $new) {
                $new->string = Mbstring::ucfirst($new->string, $this->encoding);
            }
        );
    }
1035039
public static function idize($string, $capitalize = false)
    {
        $string = mb_strtolower(static::stripDiacritics($string));

        $string = preg_replace('/[^0-9a-zA-Z-]/i', '-', $string);
        $string = preg_replace('/(-+)/i', '-', $string);
        $string = trim($string, '-');

        return $capitalize ? mb_strtoupper($string) : $string;
    }
296193
public function lowerCaseFirst()
    {
        $first = UTF8::substr($this->scalarString, 0, 1, $this->encoding);

        $rest = UTF8::substr
        (
            $this->scalarString,
            1,
            $this->getLength() - 1,
            $this->encoding
        );

        return $this->newSelf(UTF8::strtolower($first, $this->encoding).$rest);
    }
33250
public function Nice()
    {
        $owner = $this->owner;
        $value = preg_replace('/([a-z)([A-Z0-9]])/', '$1 $2', $owner->value);
        $value = preg_replace('/([a-zA-Z])-([a-zA-Z0-9])/', '$1 $2', $value);
        $value = str_replace('_', ' ', $value);
        $owner->value = trim($value);
        return $owner;
    }
969732
private static function capitalize($string)
    {
        $string = mb_strtolower($string);

        $string = mb_ereg_replace_callback('\b\w', function ($matches) {
            return mb_strtoupper($matches[0]);
        }, $string);

        // Lowercase 's
        $string = mb_ereg_replace_callback('\'\w\b', function ($matches) {
            return mb_strtolower($matches[0]);
        }, $string);

        return $string;
    }
1141762
public function capitalize( $delimiter = NULL )
	{
		$oldString		= $this->string;
		if( $delimiter === NULL ){
			$this->string	= ucfirst( $this->string );
			return $this->string !== $oldString;
		}
		else{
			return $this->capitalizeWords( $delimiter );
		}
	}
605050
public function toLowerCaseFirst() {
		$first = $this->substring(0, 1);
		$rest = $this->substring(1);

		return new Text(mb_strtolower($first, $this->encoding) . $rest, $this->encoding);
	}
523464
public static function toVariable($str)
  {
    // Remove dashes and underscores, then convert to camel case.
    $str = self::toSpaceSeparated($str);
    $str = self::toCamelCase($str);

    // Remove leading digits.
    $str = preg_replace('#^[0-9]+.*$#', '', $str);

    // Lowercase the first character.
    $first = substr($str, 0, 1);
    $first = mb_strtolower($first);

    // Replace the first character with the lowercase character.
    $str = substr_replace($str, $first, 0, 1);

    return $str;
  }
1300217
public static String upperCase(String str) {
        if(isNullOrEmpty(str)) {
            return str;
        }
        return str.toUpperCase(LOCALE_ENGLISH);
    }
478430
public static function camelCase($str, $firstChar = 'lcfirst')
    {
        $str = str_replace(['-', '_', '.'], ' ', $str);
        $str = mb_convert_case($str, MB_CASE_TITLE);
        $str = str_replace(' ', '', $str); //ucwords('ghjkiol|ghjklo', "|");
        
        if (!function_exists($firstChar)) {
            $firstChar = 'lcfirst';
        }
        $str = call_user_func($firstChar, $str);
        
        return $str;
    }
472184
private function baseToLowercase()
    {
        if (($host = parse_url($this->uri, PHP_URL_HOST)) === null) {
            return $this->uri;
        }
        $pos = strpos($this->uri, $host) + strlen($host);
        return $this->uri = substr_replace($this->uri, strtolower(substr($this->uri, 0, $pos)), 0, $pos);
    }
560879
public static function ucfirst($str)
    {
        switch (AnHelperString::strlen($str)) {
            case 0:
                return '';
            break;
            case 1:
                return AnHelperString::strtoupper($str);
            break;
            default:
                preg_match('/^(.{1})(.*)$/us', $str, $matches);
                return AnHelperString::strtoupper($matches[1]).$matches[2];
            break;
        }
    }
849490
public function toLowerCase() {
    $token = $this->getConstantName()->lastToken();
    $token->setText(strtolower($token->getText()));
    return $this;
  }
373580
public function capitalize($string)
    {
        if (!extension_loaded('mbstring')) {
            return ucfirst($string);
        }

        $encoding = Yii::app()->charset;
        $firstChar = mb_strtoupper(mb_substr($string, 0, 1, $encoding), $encoding);
        return $firstChar . mb_substr($string, 1, mb_strlen($string, $encoding) - 1, $encoding);
    }
1161991
public function preProcessString($str)
    {
        $str = str_replace("<?php", "", $str);
        $str = str_replace("<?", "", $str);
        $str = str_replace("?>", "", $str);
        $str = str_replace("'", "\x22", $str);

        $str = trim($str);

        return $str;
    }
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;
    }