是否满足最大长度要求

@param  string $value
@param  int    $length 最大长度
@return bool
481555
public static function maxLength($value, $length)
    {
        return Validator::string()->length(null, $length)->validate($value);
    }
265993
public function CheckLocal($value = '') {
        #上一次的文件
        $last = to_array(F("present"));
        #本地文件列表
        $local = $this->get_dir_list();
        #本地数据存储
        F("present", to_json($local));
        #过滤文件列表
        $residue = array(
            "check"  => [],
            "delete" => []
        );
        if ($last) {
            foreach ($local as $key => $value) {
                unset($last[$key]);
            }
        }

        $residue['delete'] = empty($last) ? $residue['delete'] : array_merge($residue['delete'], $last);
        $residue['check']  = $local;
        return $residue;
    }
797250
public static function exactLength($value, int $length, string $encoding = 'UTF-8'): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        $strlen = (int) mb_strlen((string) $value, $encoding);

        return $strlen === $length;
    }
832556
public function readLine($length = 1024)
    {
        if ($this->ensureContent() === false) {
            return false;
        }

        $line = '';
        while ($this->ensureContent()) {
            $char = $this->readByte();

            if ($char === "\n") {
                break;
            }

            if ($char === "\r") {
                if ($this->getByte() === "\n") {
                    $this->addOffset(1);
                }
                break;
            }

            $line .= $char;

            if (\strlen($line) >= $length) {
                break;
            }
        }

        return $line;
    }
132872
public static function isXhtmlLength($length)
    {
        if (is_int($length) === true) {
            return $length >= 0;
        } elseif (is_string($length) === true) {
            return preg_match("/[0-9]+%/", $length) === 1;
        } else {
            return false;
        }
    }
958739
protected function isValidString(string $value, int $length = 20): void
    {
        if (mb_strlen($value) > $length) {
            throw new InvalidStringException(sprintf('String should not exceed %s characters.', $length));
        }
    }
357290
public function checkChars($value)
    {
        if (!is_string($value)) {
            return false;
        }

        $characters = $this->getCharacters();
        if ($characters == 128) {
            for ($x = 0; $x < 128; ++$x) {
                $value = str_replace(chr($x), '', $value);
            }
        } else {
            $chars = str_split($characters);
            foreach ($chars as $char) {
                $value = str_replace($char, '', $value);
            }
        }

        if (strlen($value) > 0) {
            return false;
        }

        return true;
    }
1292290
public static function isLengthGt($value, $max)
    {
        $value = trim($value);
        if (!is_string($value)) {
            return false;
        }
        $length = function_exists('mb_strlen') ? mb_strlen($value, 'UTF-8') : strlen($value);
        is_array($max) && $max = $max[0];

        if ($max != 0 && $length <= $max) return false;
        return true;
    }
808025
private static function _parseIntArray($value)
    {
        $vals = explode(',', $value);
        $ints = [];
        foreach ($vals as $val) {
            if (is_numeric($val) === false || strpos($val, '.') !== false)
                return false; // 检测到了非int
            $ints[] = intval($val);
        }
        if (count($ints) === 0)
            return false;
        return $ints;
    }
1113111
public static function exactLength($value, $length)
    {
        if ( ! is_array($length))
        {
            $length = [$length];
        }

        foreach ($length as $strlen)
        {
            if (strlen($value) === $strlen)
            {
                return true;
            }
        }

        return false;
    }
1226995
public static function pad($value, $length = 5, $prfx = 0)
	{
		$pre = '';

		if (is_numeric($value) && $value < 0)
		{
			$pre = 'n';
			$value = abs($value);
		}

		while (strlen($value) < $length)
		{
			$value = $prfx . "$value";
		}
		return $pre . $value;
	}
640859
public function equals($value) {
        if ($value instanceof PHPString) {
            $value = $value->getValue();
        }
        return strcmp($this->value, $value) === 0;
    }
1034652
public function readBytes($length)
    {
        if ($this->offset == $this->array_size) {
            return false;
        }
        $arrays = [];
        $end = $length + $this->offset;
        for ($i = $this->offset; $i < $end; ++$i) {
            if (!isset($this->array[$i])) {
                break;
            }
            $arrays[] = $this->array[$i];
        }
        $this->offset += ($i - $this->offset); // Limit function calls

        return array_merge(...$arrays);
    }
103790
public static function Length ($value, $length_set, $options) {
		$filter = $options['filter'] ?? null;
		if (is_callable($filter)) {
			$value = $filter($value);
		}

		if (!is_array($value)) {
			$encoding = $length_set['encoding'] ?? Encoding::DEFAULT_ENCODING;
			$string_length = Strings::Length($value, $encoding);
		} else {
			$string_length = count($value);
		}

		if (($length = $length_set['length'] ?? null) !== null) {
			return $string_length === $length;
		}

		$min_length = $length_set[0] ?? $length_set['min_length'] ?? null;
		$max_length = $length_set[1] ?? $length_set['max_length'] ?? null;

		if ($min_length === null) {
			return $string_length <= $max_length;
		}

		if ($max_length === null) {
			return $min_length <= $string_length;
		}

		return ($min_length <= $string_length && $string_length <= $max_length);
	}
551745
public static function length($value, $encoding = null)
    {
        if ($encoding !== null) {
            return mb_strlen($value, $encoding);
        }

        return mb_strlen($value);
    }
827720
public static function input($length = 0)
    {
        if (self::isCli()) {
            return $length > 0 ? fgets(STDIN, $length) : fgets(STDIN);
        }

        return false;
    }
668078
public static function isLengthLt($value, $min)
    {
        $value = trim($value);
        if (!is_string($value)) {
            return false;
        }
        $length = function_exists('mb_strlen') ? mb_strlen($value, 'UTF-8') : strlen($value);
        is_array($min) && $min = $min[0];

        if ($min != 0 && $length >= $min) return false;
        return true;
    }