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






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

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

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








13.19.BreakIterator
13.19.1.Determining the Character Boundaries in a Unicode String
13.19.2.Determining the Word Boundaries in a Unicode String
13.19.3.Determining the Sentence Boundaries in a Unicode String
13.19.4.Determining Potential Line Breaks in a Unicode String
13.19.5.Word Wrap
13.19.6.Wrap multi-line strings (and get the individual lines)