vendor/codeages/biz-framework/src/Utility/Str.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Codeages\Biz\Framework\Utility;

/**
 * 字符串工具类
 *
 * 这个类的代码Copy自 Laravel Framework 的 Illuminate\Support\Str
 * 参见:https://github.com/laravel/framework/blob/5.5/src/Illuminate/Support/Str.php
 */
class Str
{
    /**
     * The cache of snake-cased words.
     *
     * @var array
     */
    protected static $snakeCache = array();

    /**
     * The cache of camel-cased words.
     *
     * @var array
     */
    protected static $camelCache = array();
    /**
     * The cache of studly-cased words.
     *
     * @var array
     */
    protected static $studlyCache = array();

    /**
     * Convert a value to camel case.
     *
     * @param string $value
     *
     * @return string
     */
    public static function camel($value)
    {
        if (isset(static::$camelCache[$value])) {
            return static::$camelCache[$value];
        }

        return static::$camelCache[$value] = lcfirst(static::studly($value));
    }

    /**
     * Return the length of the given string.
     *
     * @param string $value
     * @param string $encoding
     *
     * @return int
     */
    public static function length($value, $encoding = null)
    {
        if ($encoding) {
            return mb_strlen($value, $encoding);

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。