Determining the Word Boundaries in a Unicode String : BreakIterator « I18N « Java






Determining the Word Boundaries in a Unicode String

   

import java.text.BreakIterator;
import java.util.Locale;

public class Main {
  public static void main(String[] argv) throws Exception {

    BreakIterator iterator = BreakIterator.getWordInstance(Locale.CANADA);
    iterator.setText("a sentence");
    for (int index = iterator.first(); index != BreakIterator.DONE; index = iterator.next()) {
      System.out.println(index);
    }
  }
}

   
    
    
  








Related examples in the same category

1.BreakIterator for difference localesBreakIterator for difference locales
2.BreakIterator DemoBreakIterator Demo
3.Determining the Character Boundaries in a Unicode String
4.Determining the Sentence Boundaries in a Unicode String
5.Determining Potential Line Breaks in a Unicode String
6.Searching, Sorting, and Text Boundary Detection: Detecting Text BoundariesSearching, Sorting, and Text Boundary Detection: Detecting Text Boundaries
7.Behaves similiar to BreakIterator.getWordInstance() but handles line break delimeters as simple whitespaces.
8.Wrap multi-line strings (and get the individual lines)