endsWith

@param string  $string
@param string  $target
@param boolean $caseSensitive

@return  boolean
344770
public static function endsWith($string, $target, $caseSensitive = true)
    {
        $stringLength = Utf8String::strlen($string);
        $targetLength = Utf8String::strlen($target);

        if ($stringLength < $targetLength) {
            return false;
        }

        if (!$caseSensitive) {
            $string = strtolower($string);
            $target = strtolower($target);
        }

        $end = Utf8String::substr($string, -$targetLength);

        return $end === $target;
    }
1113406
public static function contains($needle, $haystack, $caseSensitive = true)
    {
        if (!self::isValid($haystack)) {
            return false;
        }

        list($needle, $haystack) = self::transformCase($needle, $haystack, $caseSensitive);

        return (mb_strpos($haystack, $needle) !== false);
    }
302308
function endsWith(testStr, endsStr) {
        var index = testStr.lastIndexOf(endsStr);
        if (index < 0) {
            return false;
        }
        if (endsStr.length + index == testStr.length) {
            return true;
        }
        return false;
    }
834848
public static function endsWith(string $string, $values): bool
    {
        foreach ((array) $values as $value) {
            if ($value === '' || substr($string, -strlen($value)) === $value) {
                return true;
            }
        }

        return false;
    }
47440
public static function replace($search, $replace, $string, $caseSensitive = true)
    {
        if (!self::isValid($replace)) {
            return false;
        }

        if (!$caseSensitive) {
            return str_ireplace($search, $replace, $string);
        } else {
            return str_replace($search, $replace, $string);
        }
    }
130159
public static boolean endAny(String target, List<String> endWith) {
		if (isNull(target)) {
			return false;
		}
		
		return matcher(target).ends(endWith);
	}
1191725
public static function within( $haystack, $needle, $offset = 0, $caseSensitive = false )
    {
        if ( false === $caseSensitive )
        {
            //	Case-insensitive
            return false !== stripos( $haystack, $needle, $offset );
        }

        //	Case-sensitive
        return false !== strpos( $haystack, $needle, $offset );
    }
266365
public static function endWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, -mb_strlen($needle, 'UTF-8'), null, 'UTF-8'));
    }
773694
public static function endsWith($subject, $suffix, $encoding = null)
    {
        return Rope::of($subject, $encoding)->endsWith($suffix);
    }
1323102
public static boolean endsWithIgnoreCase(@Nullable final String str,
      @Nullable final String suffix) {
    return str != null && suffix != null && str.length() >= suffix.length()
        && str.regionMatches(true, str.length() - suffix.length(), suffix, 0, suffix.length());
  }
750784
public static function endsWith($string, $end)
    {
        $l = strlen($end);
        if ($l == 0) {
            return true;
        }
        return substr($string, - $l) === $end;
    }
725554
public static function endsWith(string $paths, string $needle) : bool
    {
        if ($paths == '') {
            return false;
        }
        if ($needle == '') {
            return false;
        }

        // search forward starting from end minus needle length characters
        // see: http://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
        return (($temp = strlen($paths) - strlen($needle)) >= 0 && strpos($paths, $needle, $temp) !== false);
    }
972871
protected function textEndsWith($string, $ends_with)
    {
        $ends_with = trim($ends_with);
        if ($ends_with === '') {
            return false;
        }

        return substr_compare($string, $ends_with, -strlen($ends_with), strlen($ends_with)) === 0;
    }
921747
static function endsWith($string, $endsWith, $caseSensitive = true) {
		$len = self::strlen($endsWith);
		if ($caseSensitive) return self::substr($string, -1 * $len) == $endsWith;
		return self::strtolower(self::substr($string, -1 * $len)) == self::strtolower($endsWith);
	}
162680
public static function replaceLast(string $subject, string $search, string $replace, bool $caseSensitive = true): string
    {
        $pos = $caseSensitive ? mb_strrpos($subject, $search) : mb_strripos($subject, $search);
        if ($pos === false) {
            return $subject;
        }

        return substr_replace($subject, $replace, $pos, mb_strlen($search));
    }
436513
public void endsWith(String string) {
    checkNotNull(string);
    if (actual() == null) {
      failWithActual("expected a string that ends with", string);
    } else if (!actual().endsWith(string)) {
      failWithActual("expected to end with", string);
    }
  }
1027701
static function startsWith($string, $startsWith, $caseSensitive = true) {
		$len = self::strlen($startsWith);
		if ($caseSensitive) return self::substr($string, 0, $len) == $startsWith;
		return self::strtolower(self::substr($string, 0, $len)) == self::strtolower($startsWith);
	}