Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Scanner.php

function Scanner::doCharsWhile

Returns the string so long as $bytes matches.

Matches as far as possible with a certain set of bytes and returns the matched substring.

Parameters

string $bytes A mask of bytes to match. If ANY byte in this mask matches the: current char, the pointer advances and the char is part of the substring.

int $max The max number of chars to read.:

Return value

string

5 calls to Scanner::doCharsWhile()
Scanner::charsWhile in vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
Read chars as long as the mask matches.
Scanner::getAsciiAlpha in vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
Get the next group of characters that are ASCII Alpha characters. Note, along with getting the characters the pointer in the data will be moved as well.
Scanner::getAsciiAlphaNum in vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
Get the next group of characters that are ASCII Alpha characters and numbers. Note, along with getting the characters the pointer in the data will be moved as well.
Scanner::getHex in vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
Get the next group of that contains hex characters. Note, along with getting the characters the pointer in the data will be moved as well.
Scanner::getNumeric in vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
Get the next group of numbers. Note, along with getting the characters the pointer in the data will be moved as well.

File

vendor/masterminds/html5/src/HTML5/Parser/Scanner.php, line 399

Class

Scanner
The scanner scans over a given data input to react appropriately to characters.

Namespace

Masterminds\HTML5\Parser

Code

private function doCharsWhile($bytes, $max = null) {
    if ($this->char >= $this->EOF) {
        return false;
    }
    if (0 === $max || $max) {
        $len = strspn($this->data, $bytes, $this->char, $max);
    }
    else {
        $len = strspn($this->data, $bytes, $this->char);
    }
    $string = (string) substr($this->data, $this->char, $len);
    $this->char += $len;
    return $string;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal