src/main/java/com/spinyowl/legui/util/TextUtil.java
public static int findNextWord(String text, int current) {
    int length = text.length();
    if (current == length) {
      return length;
    }

    int next = current;
    boolean word;
    boolean startedWord = false;
    while (next < length) {
      int i = Arrays.binarySearch(wordBreakers, text.charAt(next));
      // if char at (next) is not word breaker
      if (i < 0) {
        startedWord = word = true;
      } else {
        word = false;
      }
      if (!word && startedWord) {
        break;
      }
      next++;
    }
    return next;
  }
/**
   * Used to find next word start index from current character index in provided string.
   *
   * @param text    string to search next word start index.
   * @param current current character index(current caret position in text).
   * @return character index where starts next word.
   */
Used to find next word start index from current character index in provided string.
@param text    string to search next word start index.
@param current current character index(current caret position in text).
@return character index where starts next word.
Used to find next word start index from current character index in provided string . @param text string to search next word start index . @param current current character index ( current caret position in text ) . @return character index where starts next word .
public static int findNextWord(String text, int current) {
    int length = text.length();
    if (current == length) {
      return length;
    }
    int next = current;
    boolean word;
    boolean startedWord = false;
    while (next < length) {
      int i = Arrays.binarySearch(wordBreakers, text.charAt(next));
      if (i < 0) {
        startedWord = word = true;
      } else {
        word = false;
      }
      if (!word && startedWord) {
        break;
      }
      next++;
    }
    return next;
  }
public static int findNextWord ( String text , int current ) { int length = text . length ( ) ; if ( current == length ) { return length ; } int next = current ; boolean word ; boolean startedWord = false ; while ( next < length ) { int i = Arrays . binarySearch ( wordBreakers , text . charAt ( next ) ) ; if ( i < 0 ) { startedWord = word = true ; } else { word = false ; } if ( ! word && startedWord ) { break ; } next ++ ; } return next ; }
Used to find next word start index from current character index in provided string.
Used to find next word start index from current character index in provided string .
// if char at (next) is not word breaker