Java Code Examples for com.ibm.icu.lang.UCharacter#getPropertyName()

The following examples show how to use com.ibm.icu.lang.UCharacter#getPropertyName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnicodeDataTest.java    From es6draft with MIT License 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Test
public void testAllICUBinaryProperties() {
    for (int p = UProperty.BINARY_START; p < UProperty.BINARY_LIMIT; ++p) {
        String shortName = UCharacter.getPropertyName(p, UProperty.NameChoice.SHORT);
        if (shortName != null) {
            // Does not throw.
            isBinaryProperty(shortName);
        }
        String longName = UCharacter.getPropertyName(p, UProperty.NameChoice.LONG);
        if (longName != null) {
            // Does not throw.
            isBinaryProperty(longName);
        }
    }
}
 
Example 2
Source File: UnicodeData.java    From es6draft with MIT License 5 votes vote down vote up
static Property from(String name) {
    // Don't allow loose matching.
    int property;
    CHECK: try {
        property = UCharacter.getPropertyEnum(name);
        // Filter out synthetic names.
        if (property == UProperty.GENERAL_CATEGORY_MASK) {
            return null;
        }
        String shortName = UCharacter.getPropertyName(property, UProperty.NameChoice.SHORT);
        if (shortName != null && shortName.equals(name)) {
            break CHECK;
        }
        for (int i = 0;; ++i) {
            String longName = UCharacter.getPropertyName(property, UProperty.NameChoice.LONG + i);
            if (longName != null && longName.equals(name)) {
                break CHECK;
            }
        }
    } catch (IllegalArgumentException e) {
        return null;
    }
    if (property >= UProperty.BINARY_START && property < BINARY_PROPERTY_LIMIT) {
        return BinaryProperty.forId(property);
    }
    return EnumProperty.forId(property);
}
 
Example 3
Source File: UnicodeData.java    From es6draft with MIT License 4 votes vote down vote up
@Override
public String getName() {
    return UCharacter.getPropertyName(propertyId, UProperty.NameChoice.LONG);
}
 
Example 4
Source File: UnicodeData.java    From es6draft with MIT License 4 votes vote down vote up
@Override
public String getName() {
    return UCharacter.getPropertyName(UProperty.GENERAL_CATEGORY, UProperty.NameChoice.LONG);
}
 
Example 5
Source File: UnicodeData.java    From es6draft with MIT License 4 votes vote down vote up
@Override
public String getName() {
    return UCharacter.getPropertyName(propertyId, UProperty.NameChoice.LONG);
}