Returns true when the argument is surrounded by character.

@param string $argument
@param string $character

@return bool
179294
private static function isSurroundedBy($argument, $character)
    {
        return 2 < strlen($argument) && $character === $argument[0] && $character === $argument[strlen($argument) - 1];
    }
344439
private function convertArgument($argument)
    {
        if (is_string($argument) && 0 < strlen($argument) && '@' === $argument[0]) {
            $argument = new Reference(substr($argument, 1));
        }

        return $argument;
    }
636574
function (argument) {
                    var it = toPrimitive(argument, false);
                    if (typeof it == 'string' && it.length > 2) {
                        it = TRIM ? it.trim() : $trim(it, 3);
                        var first = it.charCodeAt(0)
                            , third, radix, maxCode;
                        if (first === 43 || first === 45) {
                            third = it.charCodeAt(2);
                            if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
                        } else if (first === 48) {
                            switch (it.charCodeAt(1)) {
                                case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
                                case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
                                default: return +it;
                            }
                            for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
                                code = digits.charCodeAt(i);
                                // parseInt parses a string to a first unavailable symbol
                                // but ToNumber should return NaN if a string contains unavailable symbols
                                if (code < 48 || code > maxCode) return NaN;
                            } return parseInt(digits, radix);
                        }
                    } return +it;
                }
442165
public static function validate($argument, $argumentName = null)
    {
        if (!is_array($argument)) {
            throw new \InvalidArgumentException("Argument with name $argumentName is not an array");

        }
        foreach ($argument as $item) {
            if ($item === null) {
                // Error if Object Null
                throw new \InvalidArgumentException("Argument with name $argumentName item cannot be null");
            } else if (gettype($item) == 'string' && trim($item) == '') {
                // Error if String Empty
                throw new \InvalidArgumentException("Argument with name $argumentName item string cannot be empty");
            }
        }
        return true;
    }
499404
function isCharEnglishPunctuation(char = '') {
  if (isEmpty(char)) return false;
  return ENGLISH_PUNCTUATION_RANGES.some(([start, end]) => isCharInRange(char, start, end));
}
137999
public static boolean isAllAlpha(String str) {

	if (str == null) return false;

	for (int i = str.length() - 1; i >= 0; i--) {

	    if (!Character.isLetter(str.charAt(i))) return false;
	}

	return true;
    }
133720
private function MatchQuoted($quote_char, $i){

		$matched = '';
		while( $i < $this->input_len ){
			$c = $this->input[$i];

			//escaped character
			if( $c === '\\' ){
				$matched .= $c . $this->input[$i+1];
				$i += 2;
				continue;
			}

			if( $c === $quote_char ){
				$this->pos = $i+1;
				$this->skipWhitespace(0);
				return $matched;
			}

			if( $c === "\r" || $c === "\n" ){
				return false;
			}

			$i++;
			$matched .= $c;
		}

		return false;
	}
580530
private function hasCharacterPermission(array $permission)
    {

        $map = $this->getAffiliationMap();

        // Owning a character grants you '*' permissions to the owned object. In this
        // context, '*' acts as a wildcard for *all* permissions
        foreach ($map['char'] as $char => $permissions) {

            // in case the permissions array is not related to the character for which we're requesting access
            // skip
            if ($char != $this->getCharacterId())
                continue;

            // in case a wildcard access has been assigned (user is owner), grant access
            if (in_array('character.*', $permissions))
                return true;

            // yeah, this is dumb. So if we have an array permission, we need to
            // loop and check each in there.
            foreach ($permission as $sub_permission) {

                // check only character wildcard and specific permission
                if (in_array($sub_permission, $permissions))
                    return true;
            }
        }

        return false;
    }
1102702
public function removeArgument($argument)
    {
        if (true === isset($this->arguments[$argument])) {
            unset($this->arguments[$argument]);
        }
    }
378476
public function is(string $arg): bool
    {
        return $this->short === $arg || $this->long === $arg;
    }
383025
public static function isLowerCase($char): bool
    {
        self::handleIncomingChar($char);

        return static::compare($char, static::toLowerCase($char)) === 0;
    }
489810
protected function isDigit($char)
    {
        if ($char === null) {
            return false;
        }

        // Notice: ord(null) will return 0.
        // ord() does not work with utf-8 characters.
        $ascii = ord($char);

        // ASCII codes: 48 = '0', 57 = '9'
        return ($ascii >= 48 and $ascii <= 57);
    }
715433
public static function escapeArgument($argument)
    {
        //Fix for PHP bug #43784 escapeshellarg removes % from given string
        //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
        //@see https://bugs.php.net/bug.php?id=43784
        //@see https://bugs.php.net/bug.php?id=49446
        if ('\\' === DIRECTORY_SEPARATOR) {
            if ('' === $argument) {
                return \escapeshellarg($argument);
            }

            $escapedArgument = '';
            $quote = false;
            /** @var array $parts */
            $parts = \preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);

            foreach ($parts as $part) {
                if ('"' === $part) {
                    $escapedArgument .= '\\"';
                } elseif (self::isSurroundedBy($part, '%')) {
                    // Avoid environment variable expansion
                    $escapedArgument .= '^%"' . \mb_substr($part, 1, -1) . '"^%';
                } else {
                    // escape trailing backslash
                    if ('\\' === \mb_substr($part, -1)) {
                        $part .= '\\';
                    }
                    $quote = true;
                    $escapedArgument .= $part;
                }
            }
            if ($quote) {
                $escapedArgument = '"' . $escapedArgument . '"';
            }

            return $escapedArgument;
        }

        return "'" . \str_replace("'", "'\\''", $argument) . "'";
    }
1030028
public static function preg($text, $preg)
	{
	    if (!$preg) {
	        throw new \InvalidArgumentException('Please set the $preg pattern');
	    }

	    if (is_array($preg)) {
	        if (empty($preg['preg'])) {
	            throw new \InvalidArgumentException('The $preg argument must have "preg" key');
	        }
	        $preg = $preg['preg'];
	    }

	    return (bool)preg_match($preg, $text);
	}
1249581
protected function handleCharacter($char)
    {
        # Ignore space, as we can't select multiple options
        if ($char === " ") {
            return false;
        }

        # Use enter to select the current option
        if ($char === "\n") {
            $this->checkboxes->toggleCurrent();
        }

        return parent::handleCharacter($char);
    }
767899
public function has($argument, $alias = null)
    {
        if (isset($this->arguments[$argument])) {
            return true;
        } else
            if (! empty($alias) && isset($this->arguments[$alias])) {
                return true;
            } else {
                return false;
            }
    }
690248
public static boolean hasSingleCharacterArg(Closure c) {
        if (c.getMaximumNumberOfParameters() != 1) return false;
        String typeName = c.getParameterTypes()[0].getName();
        return typeName.equals("char") || typeName.equals("java.lang.Character");
    }