Match literal string

@param string  $what
@param boolean $eatWhitespace

@return boolean
551758
protected function literal($what, $eatWhitespace = null)
    {
        if (! isset($eatWhitespace)) {
            $eatWhitespace = $this->eatWhiteDefault;
        }

        $len = strlen($what);

        if (strcasecmp(substr($this->buffer, $this->count, $len), $what) === 0) {
            $this->count += $len;

            if ($eatWhitespace) {
                $this->whitespace();
            }

            return true;
        }

        return false;
    }
250132
public function isAllowed($what, $content = null)
    {
        $contenttype = null;
        $contentid = null;
        if ($content instanceof \Bolt\Legacy\Content) {
            // It's a Legacy content record
            $contenttype = $content;
            $contentid = $content['id'];
        } elseif ($content instanceof \Bolt\Storage\Mapping\ContentType) {
            // It's non-legacy content record.
            $contenttype = (string) $content;
        } elseif (is_array($content)) {
            // It's a contenttype
            $contenttype = $content;
        } elseif (is_string($content)) {
            $contenttype = $content;
        }

        return $this->users->isAllowed($what, $contenttype, $contentid);
    }
877668
public static boolean containsWhitespace(final CharSequence seq) {
        if (isEmpty(seq)) {
            return false;
        }
        final int strLen = seq.length();
        for (int i = 0; i < strLen; i++) {
            if (CharUtils.isWhitespace(seq.charAt(i))) {
                return true;
            }
        }
        return false;
    }
811335
public function ignoreWhitespaces(bool $bool = true): Compare
    {
        $this->ignoreWhitespaces = $this->useOption('-w', $bool);
        return $this;
    }
258991
protected function match($regex, &$out, $eatWhitespace = null)
    {
        $r = '/' . $regex . '/' . $this->patternModifiers;

        if (! preg_match($r, $this->buffer, $out, null, $this->count)) {
            return false;
        }

        $this->count += strlen($out[0]);

        if (! isset($eatWhitespace)) {
            $eatWhitespace = $this->eatWhiteDefault;
        }

        if ($eatWhitespace) {
            $this->whitespace();
        }

        return true;
    }
525298
private static function getNthTokenWithoutWhitespace($tokens, $i) {
		$j = 0;
		foreach ($tokens as $token) {
			if ($token['token'] == 'T_WHITESPACE') {
				continue;
			}
			if ($i == $j) {
				return $token;
			}
			$j++;
		}
		return null;
	}
1366559
private function eatWhitespace() {
        // Eat up array until next object is found.
        while($this->getStream() && !$this->arrayEnd) {

            for($i = 0; $i < strlen($this->stream); $i++) {
                if($this->stream{$i} == "{") {
                    // Remove the old part of the object
                    $this->stream = substr($this->stream, $i);
                    $this->openingBrackets = 0;
                    $this->closingBrackets = 0;
                    return true;
                } else if ($this->stream{$i} == "]") {
                    $this->arrayEnd = true;
                    return false;
                }
            }
        }

        $this->arrayEnd = true;
        return false;
    }
604565
public static boolean isWhiteSpace(String s)
  {

    if(null != s)
    {
      int n = s.length();
  
      for (int i = 0; i < n; i++)
      {
        if (!isWhiteSpace(s.charAt(i)))
          return false;
      }
    }

    return true;
  }
288027
private static boolean isWhiteSpace(final char ch) {
        if (ch == CHAR_SPACE) return true;
        if (ch == CHAR_TAB) return true;
        if (ch == CHAR_NEW_LINE) return true;
        if (ch == CHAR_VERTICAL_TAB) return true;
        if (ch == CHAR_CARRIAGE_RETURN) return true;
        if (ch == CHAR_FORM_FEED) return true;
        return false;
    }
1225767
protected function _camelcase2whitespace($camelCaseString, $space = " "){
  	    $re = '/(?<=[a-z])(?=[A-Z])/x';
        $a = preg_split($re, $camelCaseString);
        return join($a, $space);
  }
566042
def matches?(string, what)
      Regexp === what ? string.strip =~ what : string == what.to_s
    end
1251991
public static function hasUrl($string, &$matches = array(), $ifAll = false) {
		return 0 < self::validateByRegExp('/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/', $string, $matches, $ifAll);
	}
766040
static boolean isEmptyWhitespace(@Nullable final String s) {
        if (s == null) {
            return true;
        }
        return CharMatcher.WHITESPACE.matchesAllOf(s);
    }
640403
public static function getNextWhitespace($string, $start = -1)
    {
        while ($start < (strlen($string) - 1) && !self::isWhitespace($string[$start + 1])) {
            $start++;
        }

        if ($start === (strlen($string) - 1)) {
            return false;
        }

        $start++;

        return $start;
    }
961533
protected function whitespace()
    {
        $gotWhite = false;

        while (preg_match(static::$whitePattern, $this->buffer, $m, null, $this->count)) {
            if (isset($m[1]) && empty($this->commentsSeen[$this->count])) {
                $this->appendComment([Type::T_COMMENT, $m[1]]);

                $this->commentsSeen[$this->count] = true;
            }

            $this->count += strlen($m[0]);
            $gotWhite = true;
        }

        return $gotWhite;
    }
1031156
def matches(text, what):
    '''
    
    
    '''
    return text.find(what) > -1 if is_string(what) else what.match(text)
475771
public static function getAlpha($txt, bool $convertPoint = false, bool $allowWhiteSpaces = false, string $regex = '/[^a-zA-Z0-9 ._+-]/'): string
    {
        $from = utf8_decode("ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüŸŶÿŷÑñ /" . ($convertPoint ? '.' : ''));
        $to = "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuYYyynn" . ($allowWhiteSpaces ? ' ' : '-') . "-" . ($convertPoint ? '-' : '');
        $txt = utf8_encode(strtr(utf8_decode($txt), $from, $to));
        return preg_replace($regex, '', $txt);
    }