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

The following examples show how to use com.ibm.icu.lang.UCharacter#foldCase() . 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: UCharacterProperty.java    From fitnotifications with Apache License 2.0 6 votes vote down vote up
@Override
boolean contains(int c) {
    String nfd=Norm2AllModes.getNFCInstance().impl.getDecomposition(c);
    if(nfd!=null) {
        /* c has a decomposition */
        c=nfd.codePointAt(0);
        if(Character.charCount(c)!=nfd.length()) {
            /* multiple code points */
            c=-1;
        }
    } else if(c<0) {
        return false;  /* protect against bad input */
    }
    if(c>=0) {
        /* single code point */
        UCaseProps csp=UCaseProps.INSTANCE;
        UCaseProps.dummyStringBuilder.setLength(0);
        return csp.toFullFolding(c, UCaseProps.dummyStringBuilder,
                                 UCharacter.FOLD_CASE_DEFAULT)>=0;
    } else {
        String folded=UCharacter.foldCase(nfd, true);
        return !folded.equals(nfd);
    }
}
 
Example 2
Source File: UCharacterProperty.java    From trekarta with GNU General Public License v3.0 6 votes vote down vote up
@Override
boolean contains(int c) {
    String nfd=Norm2AllModes.getNFCInstance().impl.getDecomposition(c);
    if(nfd!=null) {
        /* c has a decomposition */
        c=nfd.codePointAt(0);
        if(Character.charCount(c)!=nfd.length()) {
            /* multiple code points */
            c=-1;
        }
    } else if(c<0) {
        return false;  /* protect against bad input */
    }
    if(c>=0) {
        /* single code point */
        UCaseProps csp=UCaseProps.INSTANCE;
        UCaseProps.dummyStringBuilder.setLength(0);
        return csp.toFullFolding(c, UCaseProps.dummyStringBuilder,
                                 UCharacter.FOLD_CASE_DEFAULT)>=0;
    } else {
        String folded=UCharacter.foldCase(nfd, true);
        return !folded.equals(nfd);
    }
}
 
Example 3
Source File: CaseFoldTransliterator.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
@Override
public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) {
    synchronized (UppercaseTransliterator.class) {
        if (sourceTargetUtility == null) {
            sourceTargetUtility = new SourceTargetUtility(new Transform<String,String>() {
                @Override
                public String transform(String source) {
                    return UCharacter.foldCase(source, true);
                }
            });
        }
    }
    sourceTargetUtility.addSourceTargetSet(this, inputFilter, sourceSet, targetSet);
}
 
Example 4
Source File: CaseInsensitiveString.java    From fitnotifications with Apache License 2.0 4 votes vote down vote up
private static String foldCase(String foldee)
{
    return UCharacter.foldCase(foldee, true);
}
 
Example 5
Source File: CaseInsensitiveString.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
protected static String foldCase(final String foldee) {
	return UCharacter.foldCase(foldee, true);
}