findWordStartOffset static method

int findWordStartOffset(
  1. String text,
  2. int offset
)

Implementation

static int findWordStartOffset(String text, int offset) {
  if (offset <= 0 || offset > text.length) return offset;
  int start = offset;
  while (start > 0 && !isWordBoundary(text[start - 1])) {
    start--;
  }
  return start;
}