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

Breadcrumb

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

function Scanner::doCharsUntil

Read to a particular match (or until $max bytes are consumed).

This operates on byte sequences, not characters.

Matches as far as possible until we reach a certain set of bytes and returns the matched substring.

Parameters

string $bytes Bytes to match.:

int $max Maximum number of bytes to scan.:

Return value

mixed Index or false if no match is found. You should use strong equality when checking the result, since index could be 0.

1 call to Scanner::doCharsUntil()
Scanner::charsUntil in vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
Read chars until something in the mask is encountered.

File

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

Class

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

Namespace

Masterminds\HTML5\Parser

Code

private function doCharsUntil($bytes, $max = null) {
    if ($this->char >= $this->EOF) {
        return false;
    }
    if (0 === $max || $max) {
        $len = strcspn($this->data, $bytes, $this->char, $max);
    }
    else {
        $len = strcspn($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