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


Java UCharacter.DIRECTIONALITY_WHITESPACE属性代码示例

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


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

示例1: skipEntityBackward

/**
 * Advances charIndex backward through an HTML character entity tag (after the closing ; has
 * already been read) and returns UCharacter.DIRECTIONALITY_WHITESPACE. It would be best to
 * figure out the actual character and return its dirtype, but this is good enough. If there is
 * no matching &, does not change charIndex and returns
 * UCharacter.DIRECTIONALITY_OTHER_NEUTRALS (for the ';' that did not start an entity after
 * all). Nevertheless, the running time for calling skipEntityBackward() in a loop remains
 * linear in the size of the text, even for a text like ";;;;;;;", because skipTagBackward()
 * also stops looking for a matching & when it encounters another ;.
 */
private byte skipEntityBackward() {
  int initialCharIndex = charIndex;
  while (charIndex > 0) {
    lastChar = text.charAt(--charIndex);
    if (lastChar == '&') {
      return UCharacter.DIRECTIONALITY_WHITESPACE;
    }
    if (lastChar == ';') {
      break;
    }
  }
  charIndex = initialCharIndex;
  lastChar = ';';
  return UCharacter.DIRECTIONALITY_OTHER_NEUTRALS;
}
 
开发者ID:google,项目名称:closure-templates,代码行数:25,代码来源:BidiUtils.java

示例2: skipEntityForward

/**
 * Advances charIndex forward through an HTML character entity tag (after the opening & has
 * already been read) and returns UCharacter.DIRECTIONALITY_WHITESPACE. It would be best to
 * figure out the actual character and return its dirtype, but this is good enough.
 */
private byte skipEntityForward() {
  while (charIndex < length && (lastChar = text.charAt(charIndex++)) != ';') {}
  return UCharacter.DIRECTIONALITY_WHITESPACE;
}
 
开发者ID:google,项目名称:closure-templates,代码行数:9,代码来源:BidiUtils.java


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