ASCII alphanumeric.

@see Validate::string()

@param mixed $subject
Checked stringified.
@param string $case
Values: lower|upper, otherwise ignored.

@return bool
False on empty.
427428
public function alphaNum($subject, string $case = '') : bool
    {
        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        if ($v === '') {
            return false;
        }
        switch ($case) {
            case 'lower':
                $regex = '/^[a-z\d]+$/';
                break;
            case 'upper':
                $regex = '/^[A-Z\d]+$/';
                break;
            default:
                $regex = '/^[a-zA-Z\d]+$/';
                break;
        }
        // ctype_... is no good for ASCII-only check, if PHP and server locale
        // is set to something non-English.
        return !!preg_match($regex, $v);
    }
70372
public static function lowercase(string $str, string $encoding = null) : bool
    {
        return static::matchesPattern($str, '^[[:lower:]]*$', $encoding);
    }
808697
public function compare($compare, $caseSensitive = true)
    {
        if ($caseSensitive) {
            return Mbstring::strcmp($this->string, $compare);
        }

        return Mbstring::strcasecmp($this->string, $compare, $this->encoding);
    }
1183199
private function persist($match, $subject, $directive, $isstring = false)
	{
		$match = isset($match[1]) ? $match[1] : null;
		$uses = $directive->uses() !== false ? $directive->uses() : null;

		$e = $this->__engine;

		if ($uses !== null && $directive->name() !== false && $this->_control($uses)) {
			return "<?php $uses ((new $subject)->message($match)) : ?>";
		}
		else if ($uses !== null && $directive->name() !== false && $this->_control($uses) === false) {
			return "<?php $uses((new $subject)->message($match)); ?>";
		}
		else if ($directive->name() !== true && $uses === null) {
			return $directive->message($match);
		}
	}
905633
public function asciiMultiLine($subject, $noCarriageReturn = false) : bool
    {
        if ($subject === null) {
            return false;
        }
        // Remove newline chars before checking if printable.
        return $this->asciiPrintable(
            str_replace(
                !$noCarriageReturn ? ["\r", "\n"] : "\n",
                '',
                '' . $subject
            )
        );
    }
427301
public static function removeLast(string $subject, string $search, bool $caseSensitive = true): string
    {
        return static::replaceLast($subject, $search, '', $caseSensitive);
    }
1106974
public static function PROPERCASE($mixedCaseString)
    {
        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);

        if (is_bool($mixedCaseString)) {
            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
        }

        return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
    }
1271084
public function _preg_filter($subject, $pattern, $replacement = '', $limit = -1)
    {
        if (!isset($subject)) {
            return;
        } else {
            return preg_filter($pattern, $replacement, $subject, $limit);
        }
    }
848396
private function replaceMatches($type, $pattern, $subject, $responseBody)
    {
        $matches = [];

        $matchCount = preg_match_all(
            $pattern,
            $subject,
            $matches
        );

        if ($matchCount > 0) {
            // we don't need full matches
            unset($matches[0]);
            $responseBody = $this->replaceMatchesInBody($matches, $type, $responseBody);
        }

        return $responseBody;
    }
503372
protected function numToLetter($num, $uppercase = FALSE)
	{
		$num -= 1;

		$letter = 	chr(($num % 26) + 97);
		$letter .= 	(floor($num/26) > 0) ? str_repeat($letter, floor($num/26)) : '';
		return 		($uppercase ? strtoupper($letter) : $letter);
	}
693138
private function validateTypeNumeric($subject): bool
    {
        // number
        if (($this->schema['type'] === 'number') && !\is_integer($subject) && !\is_float($subject)) {
            return false;
        }
        // integer
        if (($this->schema['type'] === 'integer') && !\is_integer($subject)) {
            return false;
        }
        // float
        if (($this->schema['type'] === 'float') && !\is_float($subject)) {
            return false;
        }
        return true;
    }
707059
public function ere2pcre(string $s, bool $ignorecase): string
    {
        static $cache = [], $icache = [];
        if ($ignorecase) {
            if (isset($icache[$s])) {
                return $icache[$s];
            }
        } else {
            if (isset($cache[$s])) {
                return $cache[$s];
            }
        }
        [$r, $i] = $this->_ere2pcre($s, 0);
        if ($i !== strlen($s)) {
            throw new InvalidEregException('unescaped metacharacter ")"');
        }

        if ($ignorecase) {
            return $icache[$s] = '#' . $r . '#mi';
        }

        return $cache[$s] = '#' . $r . '#m';
    }
1036376
public static function after($subject, $search)
    {
        if ($search == '') {
            return $subject;
        }

        $pos = strpos($subject, $search);

        if ($pos === false) {
            return $subject;
        }

        return substr($subject, $pos + strlen($search));
    }
1092483
public static function ToCamelCase ($subject, $prefix = '_') {
		return Regex::ReplaceCallback(
			"/(?:^|". $prefix .")([a-z])/",
			function ($matches) {return strtoupper($matches[1]);},
			$subject
		);
	}
734089
public static function changeKeyCase($data, int $case = null)
    {
        $properties = get_object_vars($data);
        foreach ($properties as &$key) {
            $value = & $data->$key;
            unset($data->$key);
            
            $changeCaseKey = ($case == CASE_UPPER) ? strtoupper($key) : strtolower($key);
            $data->$changeCaseKey = & $value;
        }
        
        return $data;
    }
968970
public static function uppercase(string $str, string $encoding = null) : bool
    {
        return static::matchesPattern($str, '^[[:upper:]]*$', $encoding);
    }
933289
protected function isMetadataMethod(string &$subject, int $key, string $pattern)
    {
        unset($key);
        if (!preg_match($pattern, $subject)) {
            $subject = false;
        }

        return;
    }