Checks for a prefix, returns everything after it if it exists
491944
function(prefix, string) {
    return string.substring(0, prefix.length) == prefix ?
        string.substring(prefix.length) :
        '';
  }
615551
function endsWith(str, prefix) {
  return (str.indexOf(prefix, str.length - prefix.length) !== -1);
}
894149
function prefixKey(key) {
    if (self.nameSpace.length > 0 && !key.startsWith(self.nameSpace)) {
      return `${self.nameSpace}:${key}`
    }
    return key;
  }
650774
def strip_prefix(string, prefix, regex=False):
    """"""
    if not isinstance(string, six.string_types) or not isinstance(prefix, six.string_types):
        msg = 'Arguments to strip_prefix must be string types. Are: {s}, {p}'\
              .format(s=type(string), p=type(prefix))
        raise TypeError(msg)

    if not regex:
        prefix = re.escape(prefix)
    if not prefix.startswith('^'):
        prefix = '^({s})'.format(s=prefix)
    return _strip(string, prefix)
853869
def prefix_search(self, job_name_prefix):
        """"""
        json = self._fetch_json()
        jobs = json['response']
        for job in jobs:
            if job.startswith(job_name_prefix):
                yield self._build_results(jobs, job)
1010409
public boolean hasNext() {
		if(done) return false;
		if(cachedNext != null) {
			return true;
		}
		while(inner.hasNext()) {
			String tmp = inner.next();
			if(tmp.startsWith(prefix)) {
				cachedNext = tmp;
				return true;
			} else if(tmp.compareTo(prefix) > 0) {
				done = true;
				return false;
			}
		}
		return false;
	}
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()
894375
def prefix?(other)
      other = other.to_key_path
      return false if other.length > length

      key_enum = each
      other.all? { |other_key| key_enum.next == other_key }
    end
411250
private static boolean propMatchesPrefix(String prefix, String key) {
        return key.startsWith(prefix) && key.length() >= prefix.length();
    }
1181966
def resolvePrefix(self, prefix):
        
        ns = Namespace.default
        if self.parent is not None:
            ns = self.parent.resolvePrefix(prefix)
        return ns
99576
def has_api_scope_with_prefix(self, prefix):
        
        if self._authorized_api_scopes is None:
            return None
        return any(
            x == prefix or x.startswith(prefix + '.')
            for x in self._authorized_api_scopes)
1279156
def is_prefix(pre_path, path):
    """"""
    pre_path = pre_path.strip('.')
    path = path.strip('.')
    return not pre_path or path.startswith(pre_path + '.')
198057
function pickPrefix(prefix, object) {
    var length = prefix.length;
    var sub;
    return foldl(
      function(acc, val, key) {
        if (key.substr(0, length) === prefix) {
          sub = key.substr(length);
          acc[sub] = val;
        }
        return acc;
      },
      {},
      object
    );
  }
728996
def get_prefix(dir="../"):
    
    prefix = glob(dir + "*.gkpStore")[0]
    prefix = op.basename(prefix).rsplit(".", 1)[0]

    return prefix
772920
public function find_by_prefix($prefix) {
        $this->ensure_path_exists();
        $prefix = preg_replace('#(\*|\?|\[)#', '[$1]', $prefix);
        $files = glob($this->glob_keys_pattern($prefix), GLOB_MARK | GLOB_NOSORT);
        $return = array();
        if ($files === false) {
            return $return;
        }
        foreach ($files as $file) {
            // Trim off ".cache" from the end.
            $return[] = substr(basename($file), 0, -6);
        }
        return $return;
    }
82216
function prefix (a, b) {
  if(a.length > b.length) return false
  var l = a.length - 1
  var lastA = a[l]
  var lastB = b[l]

  if(typeof lastA !== typeof lastB)
    return false

  if('string' == typeof lastA
    && 0 != lastB.indexOf(lastA))
      return false
  
  //handle cas where there is no key prefix
  //(a hook on an entire sublevel)
  if(a.length == 1 && isArrayLike(lastA)) l ++
  
  while(l--) {
    if(compare(a[l], b[l])) return false
  }
  return true
}
181851
def namespace_for_prefix(self, prefix):
        
        try:
            ni = self.__lookup_prefix(prefix)
        except PrefixNotFoundError:
            return None
        else:
            return ni.uri