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

Breadcrumb

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

function CodePointString::endsWith

Overrides AbstractString::endsWith

File

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

Class

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

Namespace

Symfony\Component\String

Code

public function endsWith(string|iterable|AbstractString $suffix) : bool {
    if ($suffix instanceof AbstractString) {
        $suffix = $suffix->string;
    }
    elseif (!\is_string($suffix)) {
        return parent::endsWith($suffix);
    }
    if ('' === $suffix || !preg_match('//u', $suffix)) {
        return false;
    }
    if ($this->ignoreCase) {
        return preg_match('{' . preg_quote($suffix) . '$}iuD', $this->string);
    }
    return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix));
}

API Navigation

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