code: 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;
      }
docs: This function is an exact duplicate of lastNonWhitespacePosition(Slice, int) except for one line.