...
The
BreakIterator
class implements methods for finding the location of boundaries in text. Instances ofBreakIterator
maintain a current position and scan over text returning the index of characters where boundaries occur.
The boundaries returned may be those of supplementary characters, combining character sequences, or ligature clusters. For example, an accented character might be stored as a base character and a diacritical mark.
Code Block | ||
---|---|---|
| ||
public static String trim_good(String string) { BreakIterator iter = BreakIterator.getCharacterInstance(); iter.setText(string); int i; for (i = iter.first(); i != BreakIterator.DONE; i = iter.next()) { int ch = string.codePointAt(i); if (!Character.isLetter(ch)) { break; } } if (i == BreakIterator.DONE) { // Reached first or last text boundary return ""; // The input was either blank or had only (leading) letters } else { return string.substring(i); } } |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5972452c0f302d7d-d9d8e585-40fc4705-b68abf39-bf8e22eea3b63be8bcc63905"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | Classes | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="eb9204bca7df8668-fd5a7ccb-4bd344cb-ae7cbbea-ed9188e55d8636625b645280"><ac:plain-text-body><![CDATA[ | [[Hornig 2007 | AA. Bibliography#Hornig 07]] | Problem Areas: Characters | ]]></ac:plain-text-body></ac:structured-macro> |
...