Finds the end position of the key that comes *before* this key.
428516
private function getEndOfPreviousKeyPosition($key): int
    {
        preg_match($this->getKeyRegex($key), $this->contents, $matches, PREG_OFFSET_CAPTURE, $this->currentPosition);

        if (empty($matches)) {
            // for integers, the key may not be explicitly printed
            if (\is_int($key)) {
                return $this->currentPosition;
            }

            throw new YamlManipulationFailedException(sprintf('Cannot find the key "%s"', $key));
        }

        $startOfKey = $matches[0][1];

        // if we're at the start of the file, we're done!
        if (0 === $startOfKey) {
            return 0;
        }

        /*
         * Now, walk backwards: so that the position is before any
         * whitespace, commas or line breaks. Basically, we want to go
         * back to the first character *after* the previous key started.
         */
        // walk back any spaces
        while (' ' === substr($this->contents, $startOfKey - 1, 1)) {
            --$startOfKey;
        }

        // find either a line break or a , that is the end of the previous key
        while (\in_array(($char = substr($this->contents, $startOfKey - 1, 1)), [',', "\n"])) {
            --$startOfKey;
        }

        // look for \r\n
        if ("\r" === substr($this->contents, $startOfKey - 1, 1)) {
            --$startOfKey;
        }

        // if we're at the start of a line, if the prev line is a comment, move before it
        if ($this->isCharLineBreak(substr($this->contents, $startOfKey, 1))) {
            // move one (or two) forward so the code below finds the *previous* line
            ++$startOfKey;

            if ($this->isCharLineBreak(substr($this->contents, $startOfKey, 1))) {
                ++$startOfKey;
            }

            /*
             * In a multi-line array, the previous line(s) could be 100% comments.
             * In that situation, we want to rewind to *before* the comments, so
             * that those comments are attached to the current key and move with it.
             */
            while ($this->isPreviousLineComment($startOfKey)) {
                --$startOfKey;
                // if this is a \n\r, we need to go back an extra char
                if ("\r" === substr($this->contents, $startOfKey - 1, 1)) {
                    --$startOfKey;
                }

                while (!$this->isCharLineBreak(substr($this->contents, $startOfKey - 1, 1))) {
                    --$startOfKey;

                    // we've reached the start of the file!
                    if (0 === $startOfKey) {
                        break;
                    }
                }
            }

            if (0 !== $startOfKey) {
                // move backwards one onto the previous line
                --$startOfKey;
            }

            // look for \n\r situation
            if ("\r" === substr($this->contents, $startOfKey - 1, 1)) {
                --$startOfKey;
            }
        }

        return $startOfKey;
    }
882186
private String checkPath(String key) {
        if (!key.startsWith(ValueConsts.DOLLAR_SIGN)) {
            if (!key.startsWith(ValueConsts.DOT_SIGN)) {
                key = "." + key;
            }
            key = "$" + key;
        }
        if (key.endsWith(ValueConsts.DOT_SIGN)) {
            key = key.substring(0, key.length() - 1);
        }
        return key;
    }
1264142
private Tree<Row> findEndIf( Tree<Row> pointer ){
        while( !Type.END_IF.equals( pointer.getContent().getType() ) ){
            pointer = pointer.getNext();
        }
        return pointer;
    }
1196286
function findEnd(node) {
	if (!node) {
		return undefined;
	}
	var {left, right, el} = node;
	findEnd(left);
	findEnd(right);
	node.high = Math.max(getHigh(left), getHigh(right), el.end);
	return node;
}
346986
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
	public int getTotalPaddingEnd (){
		if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
			return getPaddingEnd() + mInputView.getTotalPaddingEnd();

		return getTotalPaddingRight();
	}
13613
public static int endPos(JCTree tree) {
        if (tree.hasTag(BLOCK) && ((JCBlock) tree).endpos != Position.NOPOS)
            return ((JCBlock) tree).endpos;
        else if (tree.hasTag(SYNCHRONIZED))
            return endPos(((JCSynchronized) tree).body);
        else if (tree.hasTag(TRY)) {
            JCTry t = (JCTry) tree;
            return endPos((t.finalizer != null) ? t.finalizer
                          : (t.catchers.nonEmpty() ? t.catchers.last().body : t.body));
        } else
            return tree.pos;
    }
103421
function getrange(key, start, end, req) {
  var val = this.getKey(key, req);
  if(!val) return '';
  start = parseInt(start);
  end = parseInt(end);
  if(start < 0) start = val.length + start;
  if(end < 0) end = val.length + end;
  // TODO: buffer compat
  return (val + '').substr(start, end + 1);
}
68400
def find(self, key):
        ""
        index = self.follow_bytes(key, self.ROOT)
        if index is None:
            return -1
        if not self.has_value(index):
            return -1
        return self.value(index)
393965
private void compact(final CharSequence key) {
        final int keyLength = key.length();
        TrieNode<V> currentNode = getRoot();
        TrieNode<V> lastInUseNode = currentNode;
        int lastInUseIndex = 0;

        for (int i = 0; i < keyLength && currentNode != null; i++) {
            if (currentNode.inUse) {
                lastInUseNode = currentNode;
                lastInUseIndex = i;
            }

            currentNode = currentNode.children.get(key.charAt(i));
        }

        currentNode = lastInUseNode;

        for (int i = lastInUseIndex; i < keyLength; i++) {
            currentNode = currentNode.children.remove(key.charAt(i)).unset();
        }
    }
357691
private boolean toBoundedPrevious() throws FetchException {
        if (!toPrevious()) {
            return false;
        }

        if (mStartBound != null) {
            byte[] currentKey = getCurrentKey();
            if (currentKey == null) {
                return false;
            }
            int result = compareKeysPartially(currentKey, mStartBound);
            if (result <= 0) {
                if (result < 0 || !mInclusiveStart) {
                    // Too far now, reset to first.
                    toBoundedFirst();
                    return false;
                }
            }
        }

        return prefixMatches();
    }
968181
private boolean toBoundedFirst() throws FetchException {
        if (mStartBound == null) {
            if (!toFirst()) {
                return false;
            }
        } else {
            if (!toFirst(mStartBound.clone())) {
                return false;
            }
            if (!mInclusiveStart) {
                byte[] currentKey = getCurrentKey();
                if (currentKey == null) {
                    return false;
                }
                if (compareKeysPartially(mStartBound, currentKey) == 0) {
                    if (!toNextKey()) {
                        return false;
                    }
                }
            }
        }

        if (mEndBound != null) {
            byte[] currentKey = getCurrentKey();
            if (currentKey == null) {
                return false;
            }
            int result = compareKeysPartially(currentKey, mEndBound);
            if (result >= 0) {
                if (result > 0 || !mInclusiveEnd) {
                    return false;
                }
            }
        }

        return prefixMatches();
    }
1323482
def lastKey(self, key):
        """"""
        update = self._updateList(key)[0]
        return (update[0].key
                if update
                else None)
881994
function findBeginningAndEnd(cm, symb, inclusive) {
    var cur = cm.getCursor();
    var line = cm.getLine(cur.line);
    var chars = line.split('');
    var start = undefined;
    var end = undefined;
    var firstIndex = chars.indexOf(symb);

    // the decision tree is to always look backwards for the beginning first,
    // but if the cursor is in front of the first instance of the symb,
    // then move the cursor forward
    if (cur.ch < firstIndex) {
      cur.ch = firstIndex;
      cm.setCursor(cur.line, firstIndex+1);
    }
    // otherwise if the cursor is currently on the closing symbol
    else if (firstIndex < cur.ch && chars[cur.ch] == symb) {
      end = cur.ch; // assign end to the current cursor
      --cur.ch; // make sure to look backwards
    }

    // if we're currently on the symbol, we've got a start
    if (chars[cur.ch] == symb && end == null)
      start = cur.ch + 1; // assign start to ahead of the cursor
    else {
      // go backwards to find the start
      for (var i = cur.ch; i > -1 && start == null; i--)
        if (chars[i] == symb) start = i + 1;
    }

    // look forwards for the end symbol
    if (start != null && end == null) {
      for (var i = start, len = chars.length; i < len && end == null; i++) {
        if (chars[i] == symb) end = i;
      }
    }

    // nothing found
    // FIXME still enters insert mode
    if (start == null || end == null) return {
      start: cur, end: cur  
    };

    // include the symbols
    if (inclusive) {
      --start; ++end;
    }

    return {
      start: {line: cur.line, ch: start},
      end: {line: cur.line, ch: end}
    };
  }
154691
function endsWithString(endingValue, valueToTest) {
  const position = valueToTest.length - endingValue.length;
  const lastIndexOfValue = valueToTest.lastIndexOf(endingValue);

  return !!~lastIndexOfValue && lastIndexOfValue === position;
}
289404
public char getStopKey() {
        String value = Optional.fromNullable(getParameter(SignalParameters.STOP_KEY.symbol())).or("");
        return value.isEmpty() ? ' ' : value.charAt(0);
    }
544137
public static long end(String key) {
		long duration = getTimer(key).duration();
		localTimerMap.get().remove(key);
		return duration;
	}
495174
def get_key(s):
    '''
    
    '''
    start = s.find("[")
    end = s.find("]")
    if start == -1 or end == -1:
        return None
    if s[start + 1] == "'":
        start += 1
    if s[end - 1] == "'":
        end -= 1
    return s[start + 1:end]