当前位置: 首页>>代码示例>>Java>>正文


Java UCharacter.isHighSurrogate方法代码示例

本文整理汇总了Java中com.ibm.icu.lang.UCharacter.isHighSurrogate方法的典型用法代码示例。如果您正苦于以下问题:Java UCharacter.isHighSurrogate方法的具体用法?Java UCharacter.isHighSurrogate怎么用?Java UCharacter.isHighSurrogate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.icu.lang.UCharacter的用法示例。


在下文中一共展示了UCharacter.isHighSurrogate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: char32AtAndAdvance

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:14,代码来源:ScientificNumberFormatter.java

示例2: separated

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:20,代码来源:AlphabeticIndex.java

示例3: dirTypeForward

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * Returns the UCharacter.DIRECTIONALITY_... value of the next codepoint and advances charIndex.
 * If isHtml, and the codepoint is '<' or '&', advances through the tag/entity, and returns an
 * appropriate dirtype.
 *
 * @throws java.lang.IndexOutOfBoundsException if called when charIndex >= length or < 0.
 */
@VisibleForTesting
byte dirTypeForward() {
  lastChar = text.charAt(charIndex);
  if (UCharacter.isHighSurrogate(lastChar)) {
    int codePoint = UCharacter.codePointAt(text, charIndex);
    charIndex += UCharacter.charCount(codePoint);
    return UCharacter.getDirectionality(codePoint);
  }
  charIndex++;
  byte dirType = getCachedDirectionality(lastChar);
  if (isHtml) {
    // Process tags and entities.
    if (lastChar == '<') {
      dirType = skipTagForward();
    } else if (lastChar == '&') {
      dirType = skipEntityForward();
    }
  }
  return dirType;
}
 
开发者ID:google,项目名称:closure-templates,代码行数:28,代码来源:BidiUtils.java

示例4: characters

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * @see nu.validator.htmlparser.common.CharacterHandler#characters(char[], int, int)
 */
public void characters(char[] ch, int start, int length)
        throws SAXException {
    if (alreadyComplainedAboutThisRun) {
        return;
    }
    if (atStartOfRun) {
        char c = ch[start];
        if (pos == 1) {
            // there's a single high surrogate in buf
            if (isComposingChar(UCharacter.getCodePoint(buf[0], c))) {
                err("Text run starts with a composing character.");
            }
            atStartOfRun = false;
        } else {
            if (length == 1 && UCharacter.isHighSurrogate(c)) {
                buf[0] = c;
                pos = 1;
                return;
            } else {
                if (UCharacter.isHighSurrogate(c)) {
                    if (isComposingChar(UCharacter.getCodePoint(c,
                            ch[start + 1]))) {
                        err("Text run starts with a composing character.");
                    }
                } else {
                    if (isComposingCharOrSurrogate(c)) {
                        err("Text run starts with a composing character.");
                    }
                }
                atStartOfRun = false;
            }
        }
    }
    int i = start;
    int stop = start + length;
    if (pos > 0) {
        // there's stuff in buf
        while (i < stop && isComposingCharOrSurrogate(ch[i])) {
            i++;
        }
        appendToBuf(ch, start, i);
        if (i == stop) {
            return;
        } else {
            if (!Normalizer.isNormalized(buf, 0, pos, Normalizer.NFC, 0)) {
                errAboutTextRun();
            }
            pos = 0;
        }
    }
    if (i < stop) {
        start = i;
        i = stop - 1;
        while (i > start && isComposingCharOrSurrogate(ch[i])) {
            i--;
        }
        if (i > start) {
            if (!Normalizer.isNormalized(ch, start, i, Normalizer.NFC, 0)) {
                errAboutTextRun();
            }
        }
        appendToBuf(ch, i, stop);
    }
}
 
开发者ID:google,项目名称:caja,代码行数:68,代码来源:NormalizationChecker.java

示例5: isComposingCharOrSurrogate

import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:google,项目名称:caja,代码行数:15,代码来源:NormalizationChecker.java


注:本文中的com.ibm.icu.lang.UCharacter.isHighSurrogate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。