コード例 #1
0
ファイル: Ustring.php プロジェクト: Grummfy/Central
 public function case_is_char_printable()
 {
     $this->when($result = LUT::isCharPrintable(LUT::fromCode(0x7f)))->then->boolean($result)->isFalse()->when($result = LUT::isCharPrintable(LUT::fromCode(0xa0)))->then->boolean($result)->isTrue()->when($result = LUT::isCharPrintable(LUT::fromCode(0x1100)))->then->boolean($result)->isTrue();
 }
コード例 #2
0
ファイル: Readline.php プロジェクト: Precom/HoaConsole
 /**
  * Readline core.
  *
  * @param   string  $char    Char.
  * @return  string
  */
 public function _readLine($char)
 {
     if (isset($this->_mapping[$char]) && is_callable($this->_mapping[$char])) {
         $mapping = $this->_mapping[$char];
         return $mapping($this);
     }
     if (isset($this->_mapping[$char])) {
         $this->_buffer = $this->_mapping[$char];
     } elseif (false === Ustring::isCharPrintable($char)) {
         Console\Cursor::bip();
         return static::STATE_CONTINUE | static::STATE_NO_ECHO;
     }
     if ($this->getLineLength() == $this->getLineCurrent()) {
         $this->appendLine($this->_buffer);
         return static::STATE_CONTINUE;
     }
     $this->insertLine($this->_buffer);
     $tail = mb_substr($this->getLine(), $this->getLineCurrent() - 1);
     $this->_buffer = "" . $tail . str_repeat("", mb_strlen($tail) - 1);
     return static::STATE_CONTINUE;
 }