findBackward static method

String? findBackward(
  1. String key
)

Implementation

static String? findBackward(String key) {
  int start = dataInUse.lastIndexOf(key);
  if (start < 0) {
    return null;
  }
  String left = dataInUse.substring(0, start + key.length);
  int size = left.length;
  int n = size % SIZE;
  if (n > 0) {
    left = left.substring(0, size - n);
  }
  size = left.length;
  while ((!left.endsWith(key)) && size >= SIZE) {
    left = left.substring(0, size - SIZE);
    size = left.length;
  }
  return left;
}