private int cutWordBefore ( ) { if ( before . length ( ) > 0 ) { int cut = before . length ( ) - 1 ; while ( cut >= 0 && isDelimiter ( before . charAt ( cut ) ) ) { -- cut ; } // We know the 'cut' position character is not a // delimiter. Also cut all characters that is not // preceded by a delimiter. while ( cut > 0 ) { if ( isDelimiter ( before . charAt ( cut - 1 ) ) ) { return cut ; } -- cut ; } } return - 1 ; }
Find the position of the first character of the last word before the cursor that is preceded by a delimiter .