endsWith

@param string $string
@param string $search
@param bool   $caseSensitive
@param string $encoding

@return bool
515825
public static function endsWith(
        $string,
        $search,
        $caseSensitive = true,
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        $stringLength = Mbstring::strlen($string, $encoding);
        $targetLength = Mbstring::strlen($search, $encoding);

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

        if (!$caseSensitive) {
            $string = Mbstring::strtoupper($string, $encoding);
            $search = Mbstring::strtoupper($search, $encoding);
        }

        $end = Mbstring::substr($string, -$targetLength, null, $encoding);

        return $end === $search;
    }
1029706
public static function mustEndWith($character = '/', $string = ''){
        if (strlen($string) > 0) {
            if (substr($string, strlen($string) -1, 1) != $character) {
                return $string . $character;
            } else {
                return $string;
            }
        } else {
            return $character;
        }
    }
913952
public static function endsWith(
        string $haystack,
        string $needle,
        $caseSensitive = true
    ) : bool {
        $needleLength = strlen($needle);
        $cmp = substr_compare(
            $haystack,
            $needle,
            -($needleLength),
            $needleLength,
            !$caseSensitive
        );

        return $cmp === 0;
    }
1039175
public function substrCount($search, $caseSensitive = true)
    {
        return Mbstring::substrCount($this->string, $search, $caseSensitive, $this->encoding);
    }
35551
public static function endsWith($string, $look)
    {
        return strrpos($string, $look) === strlen($string) - strlen($look);
    }
818964
static public function endsWith($string, $needle, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($string);

            $stringPosition = mb_strlen($string, $encoding) - mb_strlen($needle, $encoding);

            if (mb_strripos($string, $needle, null, $encoding) !== $stringPosition) {
                $message = $message ?: sprintf(
                    'Value "%s" does not end with "%s".',
                    static::stringify($string),
                    static::stringify($needle)
                );

                $constraints = array('needle' => $needle, 'encoding' => $encoding);

                throw static::createException($string, $message, static::INVALID_STRING_END, $propertyPath, $constraints);
            }
        }
929985
public static function ends_with( $haystack, $needle ) {
        return ( substr( $haystack, strlen( $haystack ) - strlen( $needle ) ) == $needle );
    }
1174036
public function endsWithIgnoreCase($substring) {
		$substring = mb_strtolower($substring, $this->encoding);
		$substringLength = mb_strlen($substring, $this->encoding);
		$endOfStr = mb_strtolower(mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding));

		return (string) $substring === $endOfStr;
	}
45248
public static boolean endsWithIgnoreCase(String str, String suffix) {
        if (str == null || suffix == null) {
            return false;
        }
        if (str.endsWith(suffix)) {
            return true;
        }
        if (str.length() < suffix.length()) {
            return false;
        }

        String lcStr = str.substring(str.length() - suffix.length()).toLowerCase();
        String lcSuffix = suffix.toLowerCase();
        return lcStr.equals(lcSuffix);
    }
1083160
public function trimRight( $string, $needle, $caseSensitive = true )
	{
		$strPos = $caseSensitive ? "strpos" : "stripos";
		if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) {
			$string = substr( $string, 0, -strlen( $needle ));
		}
		return $string;
	}
655419
public static boolean endsWith(CharSequence s, String end) {
    return (s.length() >= end.length() && s.subSequence(s.length() - end.length(), s.length()).equals(end));
  }
1305625
public static function endsWith($haystack, $needle)
    {
        return $needle == substr($haystack, strlen($haystack) - strlen($needle));
    }
324281
public static boolean endsWithIgnoreCase(String str, String suffix) {
        if (str == null || suffix == null)
            return false;

        int strLength = str.length();
        int suffixLength = suffix.length();

        // return false if the string is smaller than the suffix.
        if (strLength < suffixLength)
            return false;

        // perform regionMatch with ignorecase
        if (str.regionMatches(true, strLength - suffixLength, suffix, 0, suffixLength))
            return true;

        return false;
    }
516855
public static function endsWith($haystack, $needle)
    {
        if (strlen($haystack) < strlen($needle)) {
            return false;
        }
        $end = substr($haystack, strlen($haystack) - strlen($needle), strlen($needle));

        return $needle === "" || $needle === $end;
    }
160644
private function endsWith($haystack, $needle)
    {
        $length = strlen($needle);
        if ($length === 0) {
            return true;
        }

        return substr($haystack, -$length) === $needle;
    }
322277
boolean endsWith(final Literal literal) {

        // Check whether the answer is already in the cache
        final int index = literal.getIndex();
        final Boolean cached = myPostfixCache.get(index);
        if (cached != null) {
            return cached.booleanValue();
        }

        // Get the answer and cache the result
        final boolean result = literal.matches(myChars, myChars.length - literal.getLength());
        myPostfixCache.set(index, result);
        return result;
    }
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;
    }