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

Breadcrumb

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

function AbstractString::afterLast

Parameters

string|string[] $needle:

File

vendor/symfony/string/AbstractString.php, line 129

Class

AbstractString
Represents a string of abstract characters.

Namespace

Symfony\Component\String

Code

public function afterLast(string|iterable $needle, bool $includeNeedle = false, int $offset = 0) : static {
    $str = clone $this;
    $i = null;
    if (\is_string($needle)) {
        $needle = [
            $needle,
        ];
    }
    foreach ($needle as $n) {
        $n = (string) $n;
        $j = $this->indexOfLast($n, $offset);
        if (null !== $j && $j >= $i) {
            $i = $offset = $j;
            $str->string = $n;
        }
    }
    if (null === $i) {
        return $str;
    }
    if (!$includeNeedle) {
        $i += $str->length();
    }
    return $this->slice($i);
}

API Navigation

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