本文整理汇总了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;
}
示例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;
}