title: How does BreakIterator work in Android?
body: <p>I'm making my own text processor in Android (a custom vertical script TextView for Mongolian). I thought I would have to find all the line breaking locations myself so that I could implement line wrapping, but then I discovered <a href="https://developer.android.com/reference/java/text/BreakIterator.html" rel="noreferrer"><code>BreakIterator</code></a>. This seems to find all the possible breaks between characters, words, lines, and sentences in various languages.</p>
  
  <p>I'm trying to learn how to use it. The <a href="https://developer.android.com/reference/java/text/BreakIterator.html" rel="noreferrer">documentation</a> was more helpful than average, but it was still difficult to understand from just reading. I also found a few tutorials (see <a href="http://tutorials.jenkov.com/java-internationalization/breakiterator.html" rel="noreferrer">here</a>, <a href="https://javabeanz.wordpress.com/2009/02/21/working-with-text-in-java-using-breakiterator-api/" rel="noreferrer">here</a>, and <a href="https://kodejava.org/how-do-i-breaks-a-text-or-sentence-into-words/" rel="noreferrer">here</a>) but they lacked the full explanation with output that I was looking for. </p>
  
  <p>I am adding this Q&amp;A style answer to help myself learn how to use <code>BreakIterator</code>.</p>
  
  <p>I'm making this an Android tag in addition to Java because there is <a href="https://stackoverflow.com/questions/41270091/breakiterator-in-android-counts-character-wrongly">apparently some difference</a> between them. Also, Android now supports the <a href="https://developer.android.com/reference/android/icu/text/BreakIterator.html" rel="noreferrer">ICU <code>BreakIterator</code></a> and future answers may deal with this.</p>