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

Breadcrumb

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

function CodePointString::startsWith

Overrides AbstractString::startsWith

File

vendor/symfony/string/CodePointString.php, line 242

Class

CodePointString
Represents a string of Unicode code points encoded as UTF-8.

Namespace

Symfony\Component\String

Code

public function startsWith(string|iterable|AbstractString $prefix) : bool {
    if ($prefix instanceof AbstractString) {
        $prefix = $prefix->string;
    }
    elseif (!\is_string($prefix)) {
        return parent::startsWith($prefix);
    }
    if ('' === $prefix || !preg_match('//u', $prefix)) {
        return false;
    }
    if ($this->ignoreCase) {
        return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8');
    }
    return 0 === strncmp($this->string, $prefix, \strlen($prefix));
}

API Navigation

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