This function is an exact duplicate of lastNonWhitespacePosition(Slice, int) except for one line.
351361
private static int lastNonMatchPosition(Slice utf8, int minPosition, int[] codePointsToMatch)
    {
        int position = utf8.length();
        while (position > minPosition) {
            // decode the code point before position if possible
            int codePoint;
            int codePointLength;
            byte unsignedByte = utf8.getByte(position - 1);
            if (!isContinuationByte(unsignedByte)) {
                codePoint = unsignedByte & 0xFF;
                codePointLength = 1;
            }
            else if (minPosition <= position - 2 && !isContinuationByte(utf8.getByte(position - 2))) {
                codePoint = tryGetCodePointAt(utf8, position - 2);
                codePointLength = 2;
            }
            else if (minPosition <= position - 3 && !isContinuationByte(utf8.getByte(position - 3))) {
                codePoint = tryGetCodePointAt(utf8, position - 3);
                codePointLength = 3;
            }
            else if (minPosition <= position - 4 && !isContinuationByte(utf8.getByte(position - 4))) {
                codePoint = tryGetCodePointAt(utf8, position - 4);
                codePointLength = 4;
            }
            else {
                break;
            }
            if (codePoint < 0 || codePointLength != lengthOfCodePoint(codePoint)) {
                break;
            }
            if (!matches(codePoint, codePointsToMatch)) {
                break;
            }
            position -= codePointLength;
        }
        return position;
    }
271599
def lastIndexOf(self, item):
        
        array = self.obj
        i = len(array) - 1
        if not (self._clean.isList() or self._clean.isTuple()):
            return self._wrap(-1)

        while i > -1:
            if array[i] is item:
                return self._wrap(i)
            i -= 1
        return self._wrap(-1)
1191254
private int skipWhiteSpace(String s, int start) {
        for (int i = start; i < s.length(); i++) {
            char c = s.charAt(i);
            if (!Character.isWhitespace(c)) {
                return i;
            }
        }
        return -1;
    }
1206597
static Slice compactSlice(Slice slice, int index, int length)
    {
        if (slice.isCompact() && index == 0 && length == slice.length()) {
            return slice;
        }
        return Slices.copyOf(slice, index, length);
    }
884462
private static int skipEndOfLine(String text, int offset)
   {
      char c;
      boolean finished = false;

      while (finished == false)
      {
         c = text.charAt(offset);
         switch (c)
         {
            case ' ': // found that OBJDATA could be followed by a space the EOL
            case '\r':
            case '\n':
            {
               ++offset;
               break;
            }

            case '}':
            {
               offset = -1;
               finished = true;
               break;
            }

            default:
            {
               finished = true;
               break;
            }
         }
      }

      return (offset);
   }
112368
private int dedup(Tag[] src, int ss, Tag[] dst, int ds, int len) {
    if (len == 0) {
      return ds;
    } else {
      dst[ds] = src[ss];
      String k = src[ss].key();
      int j = ds;
      final int e = ss + len;
      for (int i = ss + 1; i < e; ++i) {
        if (k.equals(src[i].key())) {
          dst[j] = src[i];
        } else {
          k = src[i].key();
          dst[++j] = src[i];
        }
      }
      return j + 1;
    }
  }
587018
private void skipWhitespace() throws SAXException, IOException {
        // OK, do it the slow way.
        char c = readCh();
        while (isWhitespace(c)) {
            c = readCh();
        }
        unread(c);
    }
1061344
private static int copyLine(byte[] src, int srcoff,
                                byte[] dst, int dstoff, int len)
    {
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"readLine", "copyLine");
        } 
        int off = srcoff;
        while ( len-- > 0 && src[off++] != '\n' ) ;
        System.arraycopy(src, srcoff, dst, dstoff, off - srcoff);
        return off - srcoff;
    }
673877
@Override
  protected void copyToNew(int position, int newPosition) {
    newAdvancedValueSumList[newPosition] = advancedValueSumList[position];
    newAdvancedValueSumOfLogsList[newPosition] = advancedValueSumOfLogsList[position];
    newAdvancedValueSumOfSquaresList[newPosition] = advancedValueSumOfSquaresList[position];
    newAdvancedValueMinList[newPosition] = advancedValueMinList[position];
    newAdvancedValueMaxList[newPosition] = advancedValueMaxList[position];
    newAdvancedValueNList[newPosition] = advancedValueNList[position];
  }
924835
void trimWhitespaceFromFunctionEnd() {
		assert (callStack.getCurrentElement().type == PushPopType.Function);

		int functionStartPoint = callStack.getCurrentElement().functionStartInOuputStream;

		// If the start point has become -1, it means that some non-whitespace
		// text has been pushed, so it's safe to go as far back as we're able.
		if (functionStartPoint == -1) {
			functionStartPoint = 0;
		}

		// Trim whitespace from END of function call
		for (int i = outputStream.size() - 1; i >= functionStartPoint; i--) {
			RTObject obj = outputStream.get(i);

			if (!(obj instanceof StringValue))
				continue;
			StringValue txt = (StringValue) obj;

			if (obj instanceof ControlCommand)
				break;

			if (txt.isNewline() || txt.isInlineWhitespace()) {
				outputStream.remove(i);
				outputStreamDirty();
			} else {
				break;
			}
		}
	}
178974
private static int skipWhite(char[] part, int startPos) {
    for (int i = startPos; i < part.length; i++) {
      if (!Character.isWhitespace(part[i])) {
        return i;
      }
    }
    return part.length;
  }
973821
public void skipWhitespace() {
        while (position < string.length()) {
            final char c = string.charAt(position);
            if (c == ' ' || c == '\n' || c == '\r' || c == '\t') {
                position++;
            } else {
                break;
            }
        }
    }
377392
function findNextNonSpacePoint(editor, pos) {
	const stream = new BufferStreamReader(editor.getBuffer(), pos);
	stream.eatWhile(isSpace);
	return stream.pos;
}
585655
public Slice copySlice(int index, int length)
    {
        checkPositionIndexes(index, index + length, this.length);

        index += offset;
        byte[] copiedArray = new byte[length];
        System.arraycopy(data, index, copiedArray, 0, length);
        return new Slice(copiedArray);
    }
169668
function LocationIndex(string) {
        // ensure newline termination
        if (string[string.length - 1] !== '\n') {
            string += '\n';
        }
        this._stringLength = string.length;
        /*
         * Each triple in _lineStartEndTriples consists of:
         * [0], the 0-based line index of the line the triple represents
         * [1], the 0-based code unit index (into the string) of the start of the line (inclusive)
         * [2], the 0-based code unit index (into the string) of the start of the next line (or the length of the string, if it is the last line)
         * A line starts with a non-newline character,
         * and always ends in a newline character, unless it is the very last line in the string.
         */
        this._lineStartEndTriples = [[0, 0]];
        var nextLineIndex = 1;
        var charIndex = 0;
        while (charIndex < string.length) {
            charIndex = string.indexOf('\n', charIndex);
            if (charIndex === -1) {
                /* istanbul ignore next */
                break;
            }
            charIndex++;// go past the newline
            this._lineStartEndTriples[this._lineStartEndTriples.length - 1].push(charIndex);
            this._lineStartEndTriples.push([nextLineIndex, charIndex]);

            nextLineIndex++;
        }
        this._lineStartEndTriples.pop();
    }
151116
@Deprecated
    @Override
    public void getOffsetFromLocal(long date,
            int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
        getOffset(date, true, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
    }
602004
@Deprecated
    @Override
    public void getOffsetFromLocal(long date,
            int nonExistingTimeOpt, int duplicatedTimeOpt, int[] offsets) {
        tz.getOffsetFromLocal(date, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
    }