Converts the first character of the supplied string to lower case.

@param  string $str      String to modify
@param  string $encoding The character encoding
@return string String with the first character being lower case
4657
public static function lowerCaseFirst($str, $encoding = null)
    {
        return (string) Stringy::create($str, $encoding)->lowerCaseFirst();
    }
724816
public static function blank(string $str, string $encoding = null) : bool
    {
        return static::matchesPattern($str, '^[[:space:]]*$', $encoding);
    }
783865
public function ucfirst($str, $encoding = null)
	{
		$encoding or $encoding = $this->encoding;

		return function_exists('mb_strtoupper')
			? mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding).
				mb_substr($str, 1, mb_strlen($str, $encoding), $encoding)
			: ucfirst($str);
	}
38012
public static function humanize($str, $encoding = null)
    {
        return (string) Stringy::create($str, $encoding)->humanize();
    }
1320355
public static function lcFirst($str)
    {
        if (self::$use_mbstring) {
            $first = self::toLower(self::sub($str, 0, 1));
            $str   = $first . self::sub($str, 1);
        } else {
            $str   = lcfirst($str);
        }
        
        return $str;
    }
167952
private static function underscore2CamelCase($str)
    {
        // Non-alpha and non-numeric characters become spaces.
        $str = preg_replace('/[^a-z0-9]+/i', ' ', $str);
        // Uppercase the first character of each word.
        $str = ucwords(trim($str));
        // Remove all spaces.
        $str = str_replace(" ", "", $str);
        // Lowercase the first character of the result.
        $str[0] = strtolower($str[0]);

        return $str;
    }
541557
public static function toCamelCase(string $str): string
    {
        $str = trim($str);
        $fn = function($arg) {
            list($match, $char) = $arg;
            $ret = str_replace($char, "", $match);
            return strtoupper($ret);
        };
        return preg_replace_callback("~( |_|-){1,}[A-Za-z]~", $fn, $str);
    }
1060667
public static function substr($str, $len, $start = 0, $encoding = 'UTF-8') {
	    if(function_exists('iconv_substr')) {
	        return iconv_substr($str, $start, $len, $encoding);
	    } elseif(function_exists('mb_substr')) {
	        return mb_substr($str, $start, $len, $encoding);
	    }
	    throw new \Exception('请先安装PHP iconv或mb_string扩展');
	}
1332437
public static function upper(string $str, string $encoding = null) : string
    {
        return mb_strtoupper($str, $encoding ?: utils\Str::encoding($str));
    }
286555
public function encodeString($str, $encoding = 'base64')
    {
        $encoded = '';
        switch (strtolower($encoding)) {
            case 'base64':
                $encoded = chunk_split(
                    base64_encode($str),
                    static::STD_LINE_LENGTH - strlen(static::$LE),
                    static::$LE
                );
                break;
            case '7bit':
            case '8bit':
                $encoded = static::normalizeBreaks($str);
                // Make sure it ends with a line break
                if (substr($encoded, -(strlen(static::$LE))) != static::$LE) {
                    $encoded .= static::$LE;
                }
                break;
            case 'binary':
                $encoded = $str;
                break;
            case 'quoted-printable':
                $encoded = $this->encodeQP($str);
                break;
            default:
                $this->setError($this->lang('encoding') . $encoding);
                break;
        }

        return $encoded;
    }
796493
public static function toCamelCase($str)
    {
        $str = ucwords(str_replace('_', ' ', $str));
        $str = str_replace(' ', '', lcfirst($str));
        return $str;
    }
31837
public static function ucfirst($str, $encoding = 'UTF-8') {
        $encoding or $encoding = 'UTF-8';
        return function_exists('mb_strtoupper') ? mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_substr($str, 1, mb_strlen($str, $encoding), $encoding) : ucfirst($str);
    }
554562
function encode_string ($str, $encoding = "base64") {
      switch(strtolower($encoding)) {
         case "base64":
            // chunk_split is found in PHP >= 3.0.6
            $encoded = chunk_split(base64_encode($str));
            break;

         case "7bit":
         case "8bit":
            $encoded = $this->fix_eol($str);
            if (substr($encoded, -2) != "\r\n")
               $encoded .= "\r\n";
            break;

         case "binary":
            $encoded = $str;
            break;

         case "quoted-printable":
            $encoded = $this->encode_qp($str);
            break;

         default:
            $this->error_handler(sprintf("Unknown encoding: %s", $encoding));
            return false;
      }
      return($encoded);
   }
1105408
public static function mb_ucfirst($str, $encoding = 'UTF-8')
    {
        $length = mb_strlen($str, $encoding);
        $firstChar = mb_substr($str, 0, 1, $encoding);
        $then = mb_substr($str, 1, $length - 1, $encoding);

        return mb_strtoupper($firstChar, $encoding) . $then;
    }
253252
public static function fromString($str, $encoding = self::ENCODING){
		
		if(!\is_string($str)){
			throw new \InvalidArgumentException('$str must be a PHP string');
		}
		
		if(!\is_string($encoding)){
			throw new \InvalidArgumentException('$encoding must be a string');
		}
		
		return new static($str, $encoding);
		
	}
1072216
public function toBin(string $str):string {
		$this->checkCharacterSet($str);

		// Convert the base32 string back to a binary string
		$str = array_map(function($chr){
			return sprintf('%08b', strpos($this->charset, $chr));
		}, str_split($str));

		// Remove the extra 0's we added
		$str = preg_replace('/000(.{5})/', '$1', implode('', $str));

		// Unpad if nessicary
		$length = strlen($str);
		$rbits = $length&7;

		if($rbits > 0){
			$str = substr($str, 0, $length-$rbits);
		}

		return $str;
	}
130263
public static function lower( $string, $encoding = null )
	{
		if ( is_null( $encoding ) )
		{
			$encoding = ClanCats::$config->charset;
		}
		return mb_strtolower( $string, $encoding );
	}