Examples of BreakIterator


Examples of java.text.BreakIterator


    public static final int getNextWord(final Document doc, final int pos)
        throws BadLocationException {

        BreakIterator bi = BreakIterator.getWordInstance();
        int length = doc.getLength();
        if (pos < 0 || pos > length) {
            throwException("No more words", pos);
        }
        String content = null;

        content = doc.getText(0, doc.getLength());
        bi.setText(content);

        int iteratorNextWord = bi.following(pos);
        while (iteratorNextWord < length
             && ((content.charAt(iteratorNextWord) == ' '
             || content.charAt(iteratorNextWord) == '\n')
             || content.charAt(iteratorNextWord) == '\t')) {
             iteratorNextWord = bi.following(iteratorNextWord);
        }
        if (iteratorNextWord == length) {
             iteratorNextWord = 0;
        }
        return iteratorNextWord;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.