本文整理汇总了Java中com.ibm.icu.lang.UCharacter.isUnicodeIdentifierPart方法的典型用法代码示例。如果您正苦于以下问题:Java UCharacter.isUnicodeIdentifierPart方法的具体用法?Java UCharacter.isUnicodeIdentifierPart怎么用?Java UCharacter.isUnicodeIdentifierPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.lang.UCharacter
的用法示例。
在下文中一共展示了UCharacter.isUnicodeIdentifierPart方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseReference
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
public String parseReference(String text, ParsePosition pos, int limit) {
int start = pos.getIndex();
int i = start;
String result = "";
while (i < limit) {
int c = UTF16.charAt(text, i);
if ((i == start && !UCharacter.isUnicodeIdentifierStart(c))
|| !UCharacter.isUnicodeIdentifierPart(c)) {
break;
}
i += UTF16.getCharCount(c);
}
if (i == start) { // No valid name chars
return result; // Indicate failure with empty string
}
pos.setIndex(i);
result = text.substring(start, i);
return result;
}
示例2: parseReference
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* Implement SymbolTable API. Parse out a symbol reference
* name.
*/
@Override
public String parseReference(String text, ParsePosition pos, int limit) {
int start = pos.getIndex();
int i = start;
while (i < limit) {
char c = text.charAt(i);
if ((i==start && !UCharacter.isUnicodeIdentifierStart(c)) ||
!UCharacter.isUnicodeIdentifierPart(c)) {
break;
}
++i;
}
if (i == start) { // No valid name chars
return null;
}
pos.setIndex(i);
return text.substring(start, i);
}
示例3: parseUnicodeIdentifier
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* Parse a Unicode identifier from the given string at the given
* position. Return the identifier, or null if there is no
* identifier.
* @param str the string to parse
* @param pos INPUT-OUPUT parameter. On INPUT, pos[0] is the
* first character to examine. It must be less than str.length(),
* and it must not point to a whitespace character. That is, must
* have pos[0] < str.length(). On
* OUTPUT, the position after the last parsed character.
* @return the Unicode identifier, or null if there is no valid
* identifier at pos[0].
*/
public static String parseUnicodeIdentifier(String str, int[] pos) {
// assert(pos[0] < str.length());
StringBuilder buf = new StringBuilder();
int p = pos[0];
while (p < str.length()) {
int ch = Character.codePointAt(str, p);
if (buf.length() == 0) {
if (UCharacter.isUnicodeIdentifierStart(ch)) {
buf.appendCodePoint(ch);
} else {
return null;
}
} else {
if (UCharacter.isUnicodeIdentifierPart(ch)) {
buf.appendCodePoint(ch);
} else {
break;
}
}
p += UTF16.getCharCount(ch);
}
pos[0] = p;
return buf.toString();
}
示例4: isUnicodeIdentifierPart
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* Indicates whether the specified code point is valid as part of a Unicode
* identifier other than the first character.
*
* @param codePoint
* the code point to check.
* @return {@code true} if {@code codePoint} is valid as part of a Unicode
* identifier; {@code false} otherwise.
*/
public static boolean isUnicodeIdentifierPart(int codePoint) {
return UCharacter.isUnicodeIdentifierPart(codePoint);
}
示例5: isUnicodeIdentifierPart
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* Answers whether the character is valid as part of a Unicode identifier as
* other than the first character.
*
* @param codePoint
* the character, including supplementary characters
* @return true when the character is valid as part of a Unicode identifier,
* false otherwise
*/
public static boolean isUnicodeIdentifierPart(int codePoint) {
return UCharacter.isUnicodeIdentifierPart(codePoint);
}