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); } } }