Is needle[p:end] a prefix of needle?
512347
private static boolean isPrefix(byte[] needle, int p) {
        int l = needle.length;
        for (int i = p, j = 0; i < l; ++i, ++j) {
            if (needle[i] != needle[j]) {
                return false;
            }
        }
        return true;
    }
1361412
boolean checkPrefix(char[] chars, int[] cursor) {
    if (chars.length > cursor[0] && chars[cursor[0]] == MatchSpace.NONWILD_MARKER)
      return false;
    if (prefix == null)
      return true;
    if (cursor[1] - cursor[0] < prefix.minlen)
      // a conservative test, but if we can't pass it, we'll certainly fail later
      return false;
    for (int i = 0; i < prefix.items.length; i++) {
      Object item = prefix.items[i];
      if (item == Pattern.matchOne)
        if (!topicSkipForward(chars, cursor))
          return false;
        else
          ; // topic skip succeeded so continue
      else if (!matchForward(chars, (char[]) item, cursor))
        return false;
      // else this phase succeeded so continue
    }
    // The prefix matches exactly.  But, unless we are at the end of the string,
    // the next character MUST be a separator.
    return cursor[0] == cursor[1] || 
      chars[cursor[0]] == MatchSpace.SUBTOPIC_SEPARATOR_CHAR;
  }
140658
def is_end_node(node):
    
    return (isinstance(node, ast.Expr) and
            isinstance(node.value, ast.Name) and
            node.value.id == 'end')
1220449
function endTagInBody(p, token) {
    const tn = token.tagName;

    switch (tn.length) {
        case 1:
            if (tn === $.A || tn === $.B || tn === $.I || tn === $.S || tn === $.U) {
                callAdoptionAgency(p, token);
            } else if (tn === $.P) {
                pEndTagInBody(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 2:
            if (tn === $.DL || tn === $.UL || tn === $.OL) {
                addressEndTagInBody(p, token);
            } else if (tn === $.LI) {
                liEndTagInBody(p, token);
            } else if (tn === $.DD || tn === $.DT) {
                ddEndTagInBody(p, token);
            } else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
                numberedHeaderEndTagInBody(p, token);
            } else if (tn === $.BR) {
                brEndTagInBody(p, token);
            } else if (tn === $.EM || tn === $.TT) {
                callAdoptionAgency(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 3:
            if (tn === $.BIG) {
                callAdoptionAgency(p, token);
            } else if (tn === $.DIR || tn === $.DIV || tn === $.NAV || tn === $.PRE) {
                addressEndTagInBody(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 4:
            if (tn === $.BODY) {
                bodyEndTagInBody(p, token);
            } else if (tn === $.HTML) {
                htmlEndTagInBody(p, token);
            } else if (tn === $.FORM) {
                formEndTagInBody(p, token);
            } else if (tn === $.CODE || tn === $.FONT || tn === $.NOBR) {
                callAdoptionAgency(p, token);
            } else if (tn === $.MAIN || tn === $.MENU) {
                addressEndTagInBody(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 5:
            if (tn === $.ASIDE) {
                addressEndTagInBody(p, token);
            } else if (tn === $.SMALL) {
                callAdoptionAgency(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 6:
            if (
                tn === $.CENTER ||
                tn === $.FIGURE ||
                tn === $.FOOTER ||
                tn === $.HEADER ||
                tn === $.HGROUP ||
                tn === $.DIALOG
            ) {
                addressEndTagInBody(p, token);
            } else if (tn === $.APPLET || tn === $.OBJECT) {
                appletEndTagInBody(p, token);
            } else if (tn === $.STRIKE || tn === $.STRONG) {
                callAdoptionAgency(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 7:
            if (
                tn === $.ADDRESS ||
                tn === $.ARTICLE ||
                tn === $.DETAILS ||
                tn === $.SECTION ||
                tn === $.SUMMARY ||
                tn === $.LISTING
            ) {
                addressEndTagInBody(p, token);
            } else if (tn === $.MARQUEE) {
                appletEndTagInBody(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 8:
            if (tn === $.FIELDSET) {
                addressEndTagInBody(p, token);
            } else if (tn === $.TEMPLATE) {
                endTagInHead(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        case 10:
            if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) {
                addressEndTagInBody(p, token);
            } else {
                genericEndTagInBody(p, token);
            }

            break;

        default:
            genericEndTagInBody(p, token);
    }
}
266365
public static function endWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, -mb_strlen($needle, 'UTF-8'), null, 'UTF-8'));
    }
491944
function(prefix, string) {
    return string.substring(0, prefix.length) == prefix ?
        string.substring(prefix.length) :
        '';
  }
885790
function(needle) {
      if (Array.isArray(needle)) {
        for (var i = needle.length; i--;) {
          if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) {
            return true;
          }
        }
        return false;
      } else {
        return wysihtml5.lang.array(arr).indexOf(needle) !== -1;
      }
    }
1077814
public static function hasEnding(string $needle, string $haystack): bool
    {
        return $needle === '' || substr($haystack, -strlen($needle)) === $needle;
    }
154691
function endsWithString(endingValue, valueToTest) {
  const position = valueToTest.length - endingValue.length;
  const lastIndexOfValue = valueToTest.lastIndexOf(endingValue);

  return !!~lastIndexOfValue && lastIndexOfValue === position;
}
194161
def endswith(self, pat):
        
        check_type(pat, str)

        return _series_bool_result(self, weld_str_endswith, pat=pat)
371747
def drop_prefix(strings):
    
    strings_without_extensions = [
        s.split(".", 2)[0] for s in strings
    ]

    if len(strings_without_extensions) == 1:
        return [os.path.basename(strings_without_extensions[0])]
    prefix_len = len(os.path.commonprefix(strings_without_extensions))
    result = [string[prefix_len:] for string in strings_without_extensions]
    if len(set(result)) != len(strings):
        # If these operations resulted in a collision, just return the original
        # strings.
        return strings
    return result
22936
def followingPrefix(prefix):
        """"""
        prefixBytes = array('B', prefix)

        changeIndex = len(prefixBytes) - 1
        while (changeIndex >= 0 and prefixBytes[changeIndex] == 0xff ):
            changeIndex = changeIndex - 1;
        if(changeIndex < 0):
            return None
        newBytes = array('B', prefix[0:changeIndex + 1])
        newBytes[changeIndex] = newBytes[changeIndex] + 1
        return newBytes.tostring()
692549
private String stem(int del, String add, String affix) {
    int stem_length = yylength() - del;
    int i = 0;

    String result=yytext().substring(0,stem_length); 

    if (option(change_case)) { result=result.toLowerCase(); }
    if (!(add.length()==0)) result+=add;

    if(option(print_affixes)) { result+=("+"+affix); }

    return result;
  }
527721
function (argument) {
                var pos;
                // -{prefix}:
                if (argument.charAt(0) === "-") {
                    argument = argument.substr(1);
                    pos = argument.indexOf(":");
                    if (-1 < pos) {
                        return [
                            argument.substr(0, pos),
                            argument.substr(pos + 1)
                        ];
                    } else {
                        return [argument];
                    }
                }
                // {prefix}=
                pos = argument.indexOf("=");
                if (-1 < pos) {
                    return [
                        argument.substr(0, pos),
                        argument.substr(pos + 1)
                    ];
                }
                // Default
                return argument;
            }
1277395
function prepend(str, prefix) {
    if (!str && str !== 0) {
        str = '';
    } else {
        str = str.toString();
    }
    return prefix + str;
}
748007
public function endWithCI($needle) {
        if (!$this->_isValid) {
            return $this;
        }
        $rPos = mb_strripos($this->_unsafeVar, $needle, null, $this->conf['encoding']);
        if ($rPos === false) {
            $this->_isValid = false;
        } else {
            $varLength = mb_strlen($this->_unsafeVar, $this->conf['encoding']);
            $needleLength = mb_strlen($needle, $this->conf['encoding']);
            if ($varLength != $rPos + $needleLength) {
                $this->_isValid = false;
            }
        }
        return $this;
    }
509338
public function endsWith( $needles ) : bool
    {
        foreach( (array)$needles as $needle ){
            if( substr( $this->__toString(), - strlen( $needle ) ) === (string)$needle ){
                return true;
            }
        }
        return false;
    }