Given a string and an interable of extensions, strip the extenion off the
    string if the string ends with one of the extensions.
484254
def strip_exts(s, exts):
    
    f_split = os.path.splitext(s)
    if f_split[1] in exts:
        return f_split[0]
    else:
        return s
575779
def rstrip_extra(fname):
    
    to_strip = ("_R", ".R", "-R", "_", "fastq", ".", "-")
    while fname.endswith(to_strip):
        for x in to_strip:
            if fname.endswith(x):
                fname = fname[:len(fname) - len(x)]
                break
    return fname
47350
def strip_optional_suffix(string, suffix, log=None):
    
    if string.endswith(suffix):
        return string[:-len(suffix)]
    if log:
        log.warn('String ends with %r, not %r', string[-len(suffix):], suffix)
    return string
1267190
def strip_required_suffix(string, suffix):
    
    if string.endswith(suffix):
        return string[:-len(suffix)]
    raise AssertionError('String ends with %r, not %r' % (string[-len(suffix):], suffix))
962691
def truncate(str, len = 80)
      if str and str.length > len and (add = str[len..-1].index(' '))
        str = str[0, len + add] + '&#8230;'
      end
      str
    end
741796
function trimTrailing(text, postfix) {
        if (text && postfix) {
            if (_.endsWith(text, postfix)) {
                return text.substring(0, text.length - postfix.length);
            }
        }
        return text;
    }
1072394
def _ParseExtensionsString(self, extensions_string):
    
    if not extensions_string:
      return

    extensions_string = extensions_string.lower()
    extensions = [
        extension.strip() for extension in extensions_string.split(',')]
    file_entry_filter = file_entry_filters.ExtensionsFileEntryFilter(extensions)
    self._filter_collection.AddFilter(file_entry_filter)
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);
    }
  }
328666
def _strip(string, pattern):
    """"""
    m = re.compile(pattern).search(string)

    if m:
        return string[0:m.start()] + string[m.end():len(string)]
    else:
        return string
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
775832
static function TrimLeft($string, $chars = null)
    {
        self::InitEncoding();
        if (!$chars)
            return ltrim($chars);

        return ltrim($string, $chars);
    }
1220086
def _slice(expr, start=None, stop=None, step=None):
    

    return _string_op(expr, Slice, _start=start, _end=stop, _step=step)
677561
def intersectsExtent(self, extent):
        ""
        return \
            self.extent[0] <= extent[2] and self.extent[2] >= extent[0] and \
            self.extent[1] <= extent[3] and self.extent[3] >= extent[1]
1290779
public boolean endsWith(String str)
    {
        /* Let's just play this safe; should seldom if ever happen...
         * and because of that, can be sub-optimal, performancewise, to
         * alternatives.
         */
        if (mInputStart >= 0) {
            unshare(16);
        }

        int segIndex = (mSegments == null) ? 0 : mSegments.size();
        int inIndex = str.length() - 1;
        char[] buf = mCurrentSegment;
        int bufIndex = mCurrentSize-1;

        while (inIndex >= 0) {
            if (str.charAt(inIndex) != buf[bufIndex]) {
                return false;
            }
            if (--inIndex == 0) {
                break;
            }
            if (--bufIndex < 0) {
                if (--segIndex < 0) { // no more data?
                    return false;
                }
                buf = mSegments.get(segIndex);
                bufIndex = buf.length-1;
            }
        }

        return true;
    }
154691
function endsWithString(endingValue, valueToTest) {
  const position = valueToTest.length - endingValue.length;
  const lastIndexOfValue = valueToTest.lastIndexOf(endingValue);

  return !!~lastIndexOfValue && lastIndexOfValue === position;
}
426670
function truncate(string) {
  if (string.length > SEG_LENGTH * 2 + 3) {
    return string.slice(0, SEG_LENGTH) + '...' + string.slice(-SEG_LENGTH);
  }

  return string;
}
1022725
def truncate(string, width):
    
    if len(string) > width:
        return string[:width-3] + '...'
    else:
        return string.ljust(width)