本文整理汇总了Java中com.ibm.icu.lang.UCharacter.hasBinaryProperty方法的典型用法代码示例。如果您正苦于以下问题:Java UCharacter.hasBinaryProperty方法的具体用法?Java UCharacter.hasBinaryProperty怎么用?Java UCharacter.hasBinaryProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.lang.UCharacter
的用法示例。
在下文中一共展示了UCharacter.hasBinaryProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNFKCDataFilesFromIcuProject
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
private static void getNFKCDataFilesFromIcuProject() throws IOException {
URL icuTagsURL = new URL(ICU_SVN_TAG_URL + "/");
URL icuReleaseTagURL = new URL(icuTagsURL, ICU_RELEASE_TAG + "/");
URL norm2url = new URL(icuReleaseTagURL, ICU_DATA_NORM2_PATH + "/");
System.err.print("Downloading " + NFKC_TXT + " ... ");
download(new URL(norm2url, NFKC_TXT), NFKC_TXT);
System.err.println("done.");
System.err.print("Downloading " + NFKC_CF_TXT + " ... ");
download(new URL(norm2url, NFKC_CF_TXT), NFKC_CF_TXT);
System.err.println("done.");
System.err.print("Downloading " + NFKC_CF_TXT + " and making diacritic rules one-way ... ");
URLConnection connection = openConnection(new URL(norm2url, NFC_TXT));
BufferedReader reader = new BufferedReader
(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
Writer writer = new OutputStreamWriter(new FileOutputStream(NFC_TXT), StandardCharsets.UTF_8);
try {
String line;
while (null != (line = reader.readLine())) {
Matcher matcher = ROUND_TRIP_MAPPING_LINE_PATTERN.matcher(line);
if (matcher.matches()) {
final String leftHandSide = matcher.group(1);
final String rightHandSide = matcher.group(2).trim();
List<String> diacritics = new ArrayList<>();
for (String outputCodePoint : rightHandSide.split("\\s+")) {
int ch = Integer.parseInt(outputCodePoint, 16);
if (UCharacter.hasBinaryProperty(ch, UProperty.DIACRITIC)
// gennorm2 fails if U+0653-U+0656 are included in round-trip mappings
|| (ch >= 0x653 && ch <= 0x656)) {
diacritics.add(outputCodePoint);
}
}
if ( ! diacritics.isEmpty()) {
StringBuilder replacementLine = new StringBuilder();
replacementLine.append(leftHandSide).append(">").append(rightHandSide);
replacementLine.append(" # one-way: diacritic");
if (diacritics.size() > 1) {
replacementLine.append("s");
}
for (String diacritic : diacritics) {
replacementLine.append(" ").append(diacritic);
}
line = replacementLine.toString();
}
}
writer.write(line);
writer.write("\n");
}
} finally {
reader.close();
writer.close();
}
System.err.println("done.");
}
示例2: getNFKCDataFilesFromIcuProject
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
private static void getNFKCDataFilesFromIcuProject() throws IOException {
URL icuTagsURL = new URL(ICU_SVN_TAG_URL + "/");
URL icuReleaseTagURL = new URL(icuTagsURL, ICU_RELEASE_TAG + "/");
URL norm2url = new URL(icuReleaseTagURL, ICU_DATA_NORM2_PATH + "/");
System.err.print("Downloading " + NFKC_TXT + " ... ");
download(new URL(norm2url, NFKC_TXT), NFKC_TXT);
System.err.println("done.");
System.err.print("Downloading " + NFKC_CF_TXT + " ... ");
download(new URL(norm2url, NFKC_CF_TXT), NFKC_CF_TXT);
System.err.println("done.");
System.err.print("Downloading " + NFKC_CF_TXT + " and making diacritic rules one-way ... ");
URLConnection connection = openConnection(new URL(norm2url, NFC_TXT));
BufferedReader reader = new BufferedReader
(new InputStreamReader(connection.getInputStream(), "UTF-8"));
Writer writer = new OutputStreamWriter(new FileOutputStream(NFC_TXT), "UTF-8");
try {
String line;
while (null != (line = reader.readLine())) {
Matcher matcher = ROUND_TRIP_MAPPING_LINE_PATTERN.matcher(line);
if (matcher.matches()) {
final String leftHandSide = matcher.group(1);
final String rightHandSide = matcher.group(2).trim();
List<String> diacritics = new ArrayList<String>();
for (String outputCodePoint : rightHandSide.split("\\s+")) {
int ch = Integer.parseInt(outputCodePoint, 16);
if (UCharacter.hasBinaryProperty(ch, UProperty.DIACRITIC)
// gennorm2 fails if U+0653-U+0656 are included in round-trip mappings
|| (ch >= 0x653 && ch <= 0x656)) {
diacritics.add(outputCodePoint);
}
}
if ( ! diacritics.isEmpty()) {
StringBuilder replacementLine = new StringBuilder();
replacementLine.append(leftHandSide).append(">").append(rightHandSide);
replacementLine.append(" # one-way: diacritic");
if (diacritics.size() > 1) {
replacementLine.append("s");
}
for (String diacritic : diacritics) {
replacementLine.append(" ").append(diacritic);
}
line = replacementLine.toString();
}
}
writer.write(line);
writer.write("\n");
}
} finally {
reader.close();
writer.close();
}
System.err.println("done.");
}
示例3: getNFKCDataFilesFromIcuProject
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
private static void getNFKCDataFilesFromIcuProject(String dir) throws IOException {
URL icuTagsURL = new URL(ICU_SVN_TAG_URL + "/");
URL icuReleaseTagURL = new URL(icuTagsURL, ICU_RELEASE_TAG + "/");
URL norm2url = new URL(icuReleaseTagURL, ICU_DATA_NORM2_PATH + "/");
logger.info("Downloading " + NFKC_TXT + " ... ");
download(new URL(norm2url, NFKC_TXT), dir + NFKC_TXT);
logger.info("done.");
logger.info("Downloading " + NFKC_CF_TXT + " ... ");
download(new URL(norm2url, NFKC_CF_TXT), dir + NFKC_CF_TXT);
logger.info("done.");
logger.info("Downloading " + NFKC_CF_TXT + " and making diacritic rules one-way ... ");
URLConnection connection = openConnection(new URL(norm2url, NFC_TXT));
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),
StandardCharsets.UTF_8));
Writer writer = new OutputStreamWriter(new FileOutputStream(dir + NFC_TXT), StandardCharsets.UTF_8)) {
String line;
while (null != (line = reader.readLine())) {
Matcher matcher = ROUND_TRIP_MAPPING_LINE_PATTERN.matcher(line);
if (matcher.matches()) {
final String leftHandSide = matcher.group(1);
final String rightHandSide = matcher.group(2).trim();
List<String> diacritics = new ArrayList<>();
for (String outputCodePoint : rightHandSide.split("\\s+")) {
int ch = Integer.parseInt(outputCodePoint, 16);
if (UCharacter.hasBinaryProperty(ch, UProperty.DIACRITIC)
// gennorm2 fails if U+0653-U+0656 are included in round-trip mappings
|| (ch >= 0x653 && ch <= 0x656)) {
diacritics.add(outputCodePoint);
}
}
if (!diacritics.isEmpty()) {
StringBuilder replacementLine = new StringBuilder();
replacementLine.append(leftHandSide).append(">").append(rightHandSide);
replacementLine.append(" # one-way: diacritic");
if (diacritics.size() > 1) {
replacementLine.append("s");
}
for (String diacritic : diacritics) {
replacementLine.append(" ").append(diacritic);
}
line = replacementLine.toString();
}
}
writer.write(line);
writer.write("\n");
}
}
logger.info("done.");
}
示例4: has
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
public boolean has(int codePoint) {
return UCharacter.hasBinaryProperty(codePoint, propertyId);
}
示例5: isIdentifierStart
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* <strong>[11.6] Names and Keywords</strong>
*
* <pre>
* IdentifierStart ::
* UnicodeIDStart
* $
* _
* \ UnicodeEscapeSequence
* UnicodeIDStart ::
* any Unicode character with the Unicode property "ID_Start".
* </pre>
*
* @param c
* the character
* @return {@code true} if the character is an identifier start character
*/
public static boolean isIdentifierStart(int c) {
if (c <= 127) {
return ('a' <= (c | 0x20) && (c | 0x20) <= 'z') || c == '$' || c == '_';
}
return UCharacter.hasBinaryProperty(c, UProperty.ID_START);
}
示例6: isIdentifierPart
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* <strong>[11.6] Names and Keywords</strong>
*
* <pre>
* IdentifierPart ::
* UnicodeIDContinue
* $
* _
* \ UnicodeEscapeSequence
* <ZWNJ>
* <ZWJ>
* UnicodeIDContinue ::
* any Unicode character with the Unicode property "ID_Continue"
* </pre>
*
* @param c
* the character
* @return {@code true} if the character is an identifier part character
*/
public static boolean isIdentifierPart(int c) {
if (c <= 127) {
return ('a' <= (c | 0x20) && (c | 0x20) <= 'z') || ('0' <= c && c <= '9') || c == '$' || c == '_';
}
if (c == '\u200C' || c == '\u200D') {
return true;
}
return UCharacter.hasBinaryProperty(c, UProperty.ID_CONTINUE);
}
示例7: isUnicodeIDStart
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* <strong>[11.6] Names and Keywords</strong>
*
* <pre>
* UnicodeIDStart ::
* any Unicode character with the Unicode property "ID_Start".
* </pre>
*
* @param c
* the character
* @return {@code true} if the character is an identifier start character
*/
public static boolean isUnicodeIDStart(int c) {
if (c <= 127) {
return ('a' <= (c | 0x20) && (c | 0x20) <= 'z');
}
return UCharacter.hasBinaryProperty(c, UProperty.ID_START);
}
示例8: isUnicodeIDContinue
import com.ibm.icu.lang.UCharacter; //导入方法依赖的package包/类
/**
* <strong>[11.6] Names and Keywords</strong>
*
* <pre>
* UnicodeIDContinue ::
* any Unicode character with the Unicode property "ID_Continue"
* </pre>
*
* @param c
* the character
* @return {@code true} if the character is an identifier part character
*/
public static boolean isUnicodeIDContinue(int c) {
if (c <= 127) {
return ('a' <= (c | 0x20) && (c | 0x20) <= 'z') || ('0' <= c && c <= '9') || c == '_';
}
return UCharacter.hasBinaryProperty(c, UProperty.ID_CONTINUE);
}