Java Code Examples for com.ibm.icu.lang.UCharacter#isLowSurrogate()
The following examples show how to use
com.ibm.icu.lang.UCharacter#isLowSurrogate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlphabeticIndex.java From fitnotifications with Apache License 2.0 | 6 votes |
/** * Return the string with interspersed CGJs. Input must have more than 2 codepoints. * <p>This is used to test whether contractions sort differently from their components. */ private String separated(String item) { StringBuilder result = new StringBuilder(); // add a CGJ except within surrogates char last = item.charAt(0); result.append(last); for (int i = 1; i < item.length(); ++i) { char ch = item.charAt(i); if (!UCharacter.isHighSurrogate(last) || !UCharacter.isLowSurrogate(ch)) { result.append(CGJ); } result.append(ch); last = ch; } return result.toString(); }
Example 2
Source File: ScientificNumberFormatter.java From fitnotifications with Apache License 2.0 | 5 votes |
private static int char32AtAndAdvance(AttributedCharacterIterator iterator) { char c1 = iterator.current(); char c2 = iterator.next(); if (UCharacter.isHighSurrogate(c1)) { // If c2 is DONE, it will fail the low surrogate test and we // skip this block. if (UCharacter.isLowSurrogate(c2)) { iterator.next(); return UCharacter.toCodePoint(c1, c2); } } return c1; }
Example 3
Source File: NormalizationChecker.java From caja with Apache License 2.0 | 3 votes |
/** * Returns <code>true</code> if the argument is a composing BMP character * or a surrogate and <code>false</code> otherwise. * * @param c a UTF-16 code unit * @return <code>true</code> if the argument is a composing BMP character * or a surrogate and <code>false</code> otherwise */ private static boolean isComposingCharOrSurrogate(char c) { if (UCharacter.isHighSurrogate(c) || UCharacter.isLowSurrogate(c)) { return true; } return isComposingChar(c); }