int size = text.getEndIndex(); for (int i=startPos;i<size;i++) { if (!Character.isLetterOrDigit(text.next())) { return i;
for (char ch = text.setIndex(startPos); ch != Segment.DONE;ch = text.next()) { if (!Character.isLetterOrDigit(ch)) { return text.getIndex();
  private static int getNextWordEnd(Segment text, int startPos) {    int size = text.getEndIndex();    for (int i=startPos;i<size;i++) {      if (!Character.isLetterOrDigit(text.next())) {        return i;      }    }    return size;  }