question: public static int moveByWord ( String text , int column , boolean forward , boolean returnCursorAtEnd ) { int curColumn = column ; int length = text . length ( ) ; int direction = forward ? 1 : - 1 ; boolean farWordEnd = ( ( direction == 1 && returnCursorAtEnd ) || ( direction == - 1 && ! returnCursorAtEnd ) ) ; boolean foundEarlyMatch = false ; if ( ! UnicodeUtils . isWhitespace ( text . charAt ( curColumn ) ) ) { curColumn = skipNonwhitespaceSimilar ( text , curColumn , forward ) ; if ( farWordEnd && curColumn - direction != column ) { curColumn -= direction ; foundEarlyMatch = true ; } } if ( ! foundEarlyMatch && curColumn >= 0 && curColumn < length ) { curColumn = skipWhitespace ( text , curColumn , forward ) ; if ( farWordEnd && curColumn >= 0 && curColumn < length ) { curColumn = skipNonwhitespaceSimilar ( text , curColumn , forward ) - direction ; } } if ( curColumn < 0 || curColumn >= length ) { return - 1 ; } return curColumn ; }
target:  Jumps to the previous or next best match given the parameters below. This may be inside the current word. For example, if the cursor is at index 1 in "hey bob", and moveByWord is called with returnCursorAtEnd=true, then the returned value will be 2 (y). If returnCursorAtEnd is false, it would return 4 (b).