@Given I press the :char key in the :field field

@param mixed $char could be either char ('b') or char-code (98)
@throws \Exception
430652
public function pressKey($char, $field)
    {
        static $keys = array(
        'backspace' => 8,
        'tab' => 9,
        'enter' => 13,
        'shift' => 16,
        'ctrl' =>  17,
        'alt' => 18,
        'pause' => 19,
        'break' => 19,
        'escape' =>  27,
        'esc' =>  27,
        'end' => 35,
        'home' =>  36,
        'left' => 37,
        'up' => 38,
        'right' =>39,
        'down' => 40,
        'insert' =>  45,
        'delete' =>  46,
        'pageup' => 33,
        'pagedown' => 34,
        'capslock' => 20,
        );

        if (is_string($char)) {
            if (strlen($char) < 1) {
                throw new \Exception('FeatureContext->keyPress($char, $field) was invoked but the $char parameter was empty.');
            } elseif (strlen($char) > 1) {
                // Support for all variations, e.g. ESC, Esc, page up, pageup.
                $char = $keys[strtolower(str_replace(' ', '', $char))];
            }
        }

        $element = $this->getSession()->getPage()->findField($field);
        if (!$element) {
            throw new \Exception("Field '$field' not found");
        }

        $driver = $this->getSession()->getDriver();
        // $driver->keyPress($element->getXpath(), $char);
        // This alternative to Driver->keyPress() handles cases that depend on
        // javascript which binds to key down/up events directly, such as Drupal's
        // autocomplete.js.
        $driver->keyDown($element->getXpath(), $char);
        $driver->keyUp($element->getXpath(), $char);
    }
1234890
protected function handleCharacter($char)
    {
        switch ($char) {
            case "\n":
                $this->output->sameLine()->write($this->util->cursor->defaultStyle());
                $this->output->sameLine()->write("\e[0m");
            return true; // Break the while loop as well

            case "\e":
                $this->handleAnsi();
            break;

            case ' ':
                $this->checkboxes->toggleCurrent();
            break;
        }

        return false;
    }
855316
protected function value_char()
	{
		$len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
		$this->value .= substr($this->data, $this->position, $len);
		$this->position += $len;
		$this->state = 'value';
	}
1019659
public static function valueOf($char): self
    {
        if (\is_string($char) || $char instanceof self) {
            return new static((string) $char);
        }

        throw new InvalidArgumentException('Unsupported character type!');
    }
479342
public function getCharIndex(string $char): int
    {
        $index = strpos($this->charsSet, $char);
        if ($index === false) {
            throw DictionaryException::charNotFound();
        }

        return $index;
    }
1083020
def press_key(self, character=''):
        
        try:
            shifted = self.is_char_shifted(character)
        except AttributeError:
            win32api.keybd_event(character, 0, 0, 0)
        else:
            if shifted:
                win32api.keybd_event(self.shift_key, 0, 0, 0)
            char_vk = win32api.VkKeyScan(character)
            win32api.keybd_event(char_vk, 0, 0, 0)
1335996
public function padLeft($num, self $char){
		
		if(!\is_numeric($num)){
			throw new \InvalidArgumentException('$num is not an int');
		}
		
		return new static($char->repeat($num)->_Value . $this->_Value, $this->_Encoding);
		
	}
265394
public function escapeCharacterClass($char)
	{
		return (isset($this->inCharacterClass[$char])) ? $this->inCharacterClass[$char] : $char;
	}
1081117
public function setString($string)
    {
        if (null === $string) {
            throw new Exception('The string cannot be null.');
        }

        $this->hash = md5($string);

        $this->convertHashToArrayOfBoolean();

        return $this;
    }
70324
private char checkKey(Object key) {
	if (key == null) {
	    throw new NullPointerException("key cannot be null");
	} else if (!(key instanceof Character)) {
	    throw new IllegalArgumentException("key must be an Character");
	}
	else {
	    return ((Character)key).charValue();
	}
    }
1274426
private function validate()
    {
        if (!stristr(self::CHARACTER_LIST, $this->value[0])) {
            throw new \Exception('Invalid first character: ' . $this->value[0]);
        }

        if (!in_array($this->value, self::listForCharacter($this->value[0]))) {
            throw new \Exception('Word not in known list of words: ' . $this->value);
        }
    }
353896
private function _parseHADocField($string) {
    $separater = '=';
    $pos = strpos($string, $separater);

    if ($pos !== false) {
      $key = substr($string, 0, $pos);
      $value = substr($string, $pos + 1);
      return array($key, $value);
    } else {
      throw new Exception('The are no key and value in the field.');
    }
  }
177725
public function add($char, $expr)
	{
		$split = $this->input->split($char);
		if (count($split) !== 1)
		{
			throw new InvalidArgumentException('Meta-characters must be represented by exactly one character');
		}
		if (@preg_match('(' . $expr . ')u', '') === false)
		{
			throw new InvalidArgumentException("Invalid expression '" . $expr . "'");
		}

		$inputValue = $split[0];
		$metaValue  = $this->computeValue($expr);

		$this->exprs[$metaValue] = $expr;
		$this->meta[$inputValue] = $metaValue;
	}
63977
public function protect($key) {
        if (!is_string($key)) {
            throw new \Calf\Exception\InvalidArgument('Key must be string.');
        }

        if (!isset($this->_keys[$key])) {
            throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key);
        }

        $this->_protected[$key] = true;
    }
1338812
private function getCharIndex(string $char): int {
        if (\strlen($char) > 1) $char = \substr($char, 0, 1);
        return \ord($char) - \ord('a');
    }
420231
private function getFieldData($field)
    {
        if (!isset($this->_fieldData[$field])) {
            foreach ($this->fields as $f) {
                if (($f['key'] === $field) || ($f['name'] === $field)) {
                    $this->_fieldData[$field] = $f;
                    break;
                }
            }
        }

        if (isset($this->_fieldData[$field])) {
            return $this->_fieldData[$field];
        } else {
            throw new Exception("Field $field does not exist");
        }
    }
893841
public static function isLetterOrDigit($char)
    {
        $pattern = self::getLetterOrDigitPattern();

        return is_scalar($char) && (bool)preg_match($pattern, $char);
    }