Split off any suffix from ID

    This mimics the old behavior of the Sample ID.
979685
def strip_suffix(id):
    
    suffix = get_suffix(id)
    if not suffix:
        return id
    return re.split(suffix, id)[0]
1178571
def split_on(s, sep=" "):
    """"""
    pattern = '''((?:[^%s"']|"[^"]*"|'[^']*')+)''' % sep

    return [_strip_speechmarks(t) for t in re.split(pattern, s)[1::2]]
935663
public static String cut(String s, String suffix) {
    return(s.substring(0,s.length()-suffix.length()));
  }
142521
function(id) {
    for (var ii = 0; ii < s_timeouts.length; ++ii) {
      if (s_timeouts[ii].id === id) {
        s_timeouts.splice(ii, 1);
        return;
      }
    }
  }
862927
def remove_vectored_io_slice_suffix_from_name(name, slice):
    # type: (str, int) -> str
    
    suffix = '.bxslice-{}'.format(slice)
    if name.endswith(suffix):
        return name[:-len(suffix)]
    else:
        return name
1026494
def remove_isoforms(ids):
    
    key = lambda x: x.rsplit(".", 1)[0]
    iso_number = lambda x: get_number(x.split(".")[-1])
    ids = sorted(ids, key=key)
    newids = []
    for k, ii in groupby(ids, key=key):
        min_i = min(list(ii), key=iso_number)
        newids.append(min_i)
    return newids
67468
public static function cleanId($id)
    {
        // Remove non allowed characters
        $id = preg_replace('/[^A-Za-z0-9\-\_\/~]/', '', $id);

        // Replace multiple slashes
        $id = preg_replace('/\/+/', '/', $id);

        return trim($id, '/');
    }
445868
def exttype(suffix):
    """"""
    def inner(s):
        if s == '':
            return s
        first, last = os.path.splitext(s)
        return first + suffix
    return inner
160832
def strip_suffix(string, suffix, regex=False):
    """"""
    if not isinstance(string, six.string_types) or not isinstance(suffix, six.string_types):
        msg = 'Arguments to strip_suffix must be string types. Are: {s}, {p}'\
              .format(s=type(string), p=type(suffix))
        raise TypeError(msg)

    if not regex:
        suffix = re.escape(suffix)
    if not suffix.endswith('$'):
        suffix = '({s})$'.format(s=suffix)
    return _strip(string, suffix)
723644
def decode(self, ids):
    """"""
    ids = text_encoder.pad_decr(ids)
    subword_ids = ids
    del ids

    subwords = []

    # Some ids correspond to bytes. Because unicode characters are composed of
    # possibly multiple bytes, we attempt to decode contiguous lists of bytes
    # all together. Invalid byte sequences are replaced with the unicode
    # replacement (i.e. unknown) character U+FFFD.
    prev_bytes = []

    def consume_prev_bytes():
      if prev_bytes:
        bytestr = b"".join(prev_bytes)
        bytes_text = bytestr.decode("utf-8", "replace")
        subwords.append(bytes_text)
      return []

    for subword_id in subword_ids:
      subword = self._id_to_subword(subword_id)
      if isinstance(subword, six.binary_type):
        # Byte-encoded
        prev_bytes.append(subword)
      else:
        # If there were bytes previously, convert to unicode.
        prev_bytes = consume_prev_bytes()
        trimmed, add_space = _trim_underscore_and_tell(subword)
        subwords.append(trimmed)
        if add_space:
          subwords.append(" ")
    # If there were trailing bytes, convert to unicode.
    prev_bytes = consume_prev_bytes()

    return tf.compat.as_text("".join(subwords))
1087283
private static String cleanIdentifier(final String identifier) {
        final String id = identifier.split("#")[0].split("\\?")[0];
        if (id.endsWith("/")) {
            return id.substring(0, id.length() - 1);
        }
        return id;
    }
1342963
def trim_common_suffixes(strs, min_len=0):
    

    if len(strs) < 2:
        return 0, strs

    rev_strs = [s[::-1] for s in strs]

    trimmed, rev_strs = trim_common_prefixes(rev_strs, min_len)

    if trimmed:
        strs = [s[::-1] for s in rev_strs]

    return trimmed, strs
993686
public String deduplicate(String name){
		long id = nextId(name);
		if (id == 0){	// the first one
			return name;
		}else{
			return String.format(renamePattern, name, id);
		}
	}
192641
@Deprecated 
	private String idSuffix(String name, DomainObject to) {
		if (useIdSuffixInForeignKey()) {
			Attribute idAttribute = getIdAttribute(to);
			if (idAttribute != null) {
				String idName = idAttribute.getDatabaseColumn().toUpperCase();
				String convertedName = convertDatabaseName(name);
				if (idName.equals(convertedName) && idName.startsWith(to.getDatabaseTable())) {
					idName = idName.substring(to.getDatabaseTable().length());
				} else if (idName.startsWith(convertedName)) {
					idName = idName.substring(convertedName.length());
				}
				if (idName.startsWith("_")) {
					return idName;
				} else {
					return ("_" + idName);
				}
			}
		}
		return "";
	}
1225702
def variation(id)
      variations.select { |v| v.id.split(':').last == id }.first
    end
687811
public WyalFile.Name convert(QualifiedName id, String suffix, SyntacticItem context) {
		return convert(id.getUnit(), id.getName().get().concat(suffix), context);
	}
706806
def _clean_name(fname, data):
    
    for to_remove in dd.get_batches(data) + [dd.get_sample_name(data), data["sv"]["variantcaller"]]:
        for ext in ("-", "_"):
            if fname.startswith("%s%s" % (to_remove, ext)):
                fname = fname[len(to_remove) + len(ext):]
        if fname.startswith(to_remove):
            fname = fname[len(to_remove):]
    return fname