Checks whether a given string ends with another (sub)string

@param string $strHaystack
@param string $strNeedle

@return bool
979561
final public static function endsWith($strHaystack, $strNeedle)
    {
        // If the length of needle is greater than the length of haystack, then return false
        if (strlen($strNeedle) > strlen($strHaystack)) {
            // To supress the error in strpos function below
            return false;
        }

        // search forward starting from end minus needle length characters
        return $strNeedle === "" || strpos($strHaystack, $strNeedle,
                strlen($strHaystack) - strlen($strNeedle)) !== 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;
    }
1305625
public static function endsWith($haystack, $needle)
    {
        return $needle == substr($haystack, strlen($haystack) - strlen($needle));
    }
1077814
public static function hasEnding(string $needle, string $haystack): bool
    {
        return $needle === '' || substr($haystack, -strlen($needle)) === $needle;
    }
1316621
public static function endsWith($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            if (substr($haystack, -strlen($needle)) === (string) $needle) {
                return true;
            }
        }

        return false;
    }
543432
protected function stringEndsWith($string, $stringToSearch)
    {
        return (substr($string, strlen($string) - strlen($stringToSearch)) === $stringToSearch);
    }
511142
function endsWith(longStr, shortStr) {
		var longLen = longStr.length, shortLen = shortStr.length;
		return (longLen >= shortLen) &&
			(longStr.substr(longLen - shortLen) === shortStr);
	}
1264102
public static function endsWith(
        string $haystack,
        string $needle,
        bool $caseSensitive = false
    ): bool
    {
        $test = substr($haystack, -strlen($needle));
        return ($caseSensitive === false)
            ? strcasecmp($test, $needle) === 0
            : strcmp($test, $needle) === 0;
    }
1010896
public static function  endsWith( $haystack , $needle )
	{
		return $needle === "" || ( ( $temp = strlen( $haystack ) - strlen( $needle ) ) >= 0 && strpos( $haystack , $needle , $temp ) !== false );
	}
511455
private static String stripExtraLineEnd(String text, boolean formalRTF)
   {
      if (formalRTF && text.endsWith("\n"))
      {
         text = text.substring(0, text.length() - 1);
      }
      return text;
   }
1033998
public boolean endsWith(ICMLModule oneButLast, ICMLModule lastElement) {
        return endsWith(lastElement) && stack[sp - 2].equals(oneButLast);
    }
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;
    }
168266
public static function endsWith($needle, $haystack, $caseSensitive = true)
    {
        list($needle, $haystack) = self::transformCase($needle, $haystack, $caseSensitive);

        return (self::substring($haystack, -(self::length($needle))) === $needle);
    }
127814
public static boolean equalsAnyBottomElement(final LinkedList<String> stack, final String[] strs) {
        
        ArgUtils.notNull(stack, "stack");
        ArgUtils.notEmpty(strs, "strs");
        
        if(stack.isEmpty()) {
            return false;
        }
        
        final String bottom = stack.peekLast();
        for(String str : strs) {
            if(str.equals(bottom)) {
                return true;
            }
        }
        
        return false;
        
    }
960863
public static function EndsWithValidTldString( string &$stringToCheck, bool $convertUniCode = false ) : bool
   {

      if ( $convertUniCode ) { $stringToCheck = idnToASCII( $stringToCheck ); }

      return (bool) \preg_match(
         '~\.(' . static::DOUBLE_TLDS . '|' . static::KNOWN_FORMAT . ')\.?$~i',
         $stringToCheck
      );

   }
1100193
public static boolean endsWith(CharSequence buf, CharSequence end) {
    int len = end.length(), start = buf.length() - len;
    if(start < 0) {
      return false;
    }
    for(int i = 0; i < len; i++, start++) {
      if(buf.charAt(start) != end.charAt(i)) {
        return false;
      }
    }
    return true;
  }
1099011
public static function onlyThrowsOrExits(array $stmts)
    {
        if (empty($stmts)) {
            return false;
        }

        for ($i = count($stmts) - 1; $i >= 0; --$i) {
            $stmt = $stmts[$i];

            if ($stmt instanceof PhpParser\Node\Stmt\Throw_
                || ($stmt instanceof PhpParser\Node\Stmt\Expression
                    && $stmt->expr instanceof PhpParser\Node\Expr\Exit_)
            ) {
                return true;
            }
        }

        return false;
    }