当前位置: 首页>>代码示例>>Java>>正文


Java Normalizer类代码示例

本文整理汇总了Java中sun.text.Normalizer的典型用法代码示例。如果您正苦于以下问题:Java Normalizer类的具体用法?Java Normalizer怎么用?Java Normalizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Normalizer类属于sun.text包,在下文中一共展示了Normalizer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAfterI

import sun.text.Normalizer; //导入依赖的package包/类
/**
 * Implements the "After_I" condition
 *
 * Specification: The last preceding base character was an uppercase I,
 * and there is no intervening combining character class 230 (ABOVE).
 *
 * Regular Expression:
 *   Before C: [I]([{cc!=230}&{cc!=0}])*
 */
private static boolean isAfterI(String src, int index) {
    int ch;
    int cc;

    // Look for the last preceding base character
    for (int i = index; i > 0; i -= Character.charCount(ch)) {

        ch = src.codePointBefore(i);

        if (ch == 'I') {
            return true;
        } else {
            cc = Normalizer.getCombiningClass(ch);
            if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) {
                return false;
            }
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ConditionalSpecialCasing.java

示例2: isAfterSoftDotted

import sun.text.Normalizer; //导入依赖的package包/类
/**
 * Implements the "After_Soft_Dotted" condition
 *
 * Specification: The last preceding character with combining class
 * of zero before C was Soft_Dotted, and there is no intervening
 * combining character class 230 (ABOVE).
 *
 * Regular Expression:
 *   Before C: [{Soft_Dotted==true}]([{cc!=230}&{cc!=0}])*
 */
private static boolean isAfterSoftDotted(String src, int index) {
    int ch;
    int cc;

    // Look for the last preceding character
    for (int i = index; i > 0; i -= Character.charCount(ch)) {

        ch = src.codePointBefore(i);

        if (isSoftDotted(ch)) {
            return true;
        } else {
            cc = Normalizer.getCombiningClass(ch);
            if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) {
                return false;
            }
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:ConditionalSpecialCasing.java

示例3: isMoreAbove

import sun.text.Normalizer; //导入依赖的package包/类
/**
 * Implements the "More_Above" condition
 *
 * Specification: C is followed by one or more characters of combining
 * class 230 (ABOVE) in the combining character sequence.
 *
 * Regular Expression:
 *   After C: [{cc!=0}]*[{cc==230}]
 */
private static boolean isMoreAbove(String src, int index) {
    int ch;
    int cc;
    int len = src.length();

    // Look for a following ABOVE combining class character
    for (int i = index + Character.charCount(src.codePointAt(index));
            i < len; i += Character.charCount(ch)) {

        ch = src.codePointAt(i);
        cc = Normalizer.getCombiningClass(ch);

        if (cc == COMBINING_CLASS_ABOVE) {
            return true;
        } else if (cc == 0) {
            return false;
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ConditionalSpecialCasing.java

示例4: isBeforeDot

import sun.text.Normalizer; //导入依赖的package包/类
/**
 * Implements the "Before_Dot" condition
 *
 * Specification: C is followed by <code>U+0307 COMBINING DOT ABOVE</code>.
 * Any sequence of characters with a combining class that is
 * neither 0 nor 230 may intervene between the current character
 * and the combining dot above.
 *
 * Regular Expression:
 *   After C: ([{cc!=230}&{cc!=0}])*[\u0307]
 */
private static boolean isBeforeDot(String src, int index) {
    int ch;
    int cc;
    int len = src.length();

    // Look for a following COMBINING DOT ABOVE
    for (int i = index + Character.charCount(src.codePointAt(index));
            i < len; i += Character.charCount(ch)) {

        ch = src.codePointAt(i);

        if (ch == '\u0307') {
            return true;
        } else {
            cc = Normalizer.getCombiningClass(ch);
            if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) {
                return false;
            }
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:ConditionalSpecialCasing.java

示例5: normalize

import sun.text.Normalizer; //导入依赖的package包/类
private StringBuffer normalize(StringBuffer src){
    /*
     * Option UNORM_BEFORE_PRI_29:
     *
     * IDNA as interpreted by IETF members (see unicode mailing list 2004H1)
     * requires strict adherence to Unicode 3.2 normalization,
     * including buggy composition from before fixing Public Review Issue #29.
     * Note that this results in some valid but nonsensical text to be
     * either corrupted or rejected, depending on the text.
     * See http://www.unicode.org/review/resolved-pri.html#pri29
     * See unorm.cpp and cnormtst.c
     */
    return new StringBuffer(
        Normalizer.normalize(
            src.toString(),
            java.text.Normalizer.Form.NFKC,
            Normalizer.UNICODE_3_2|NormalizerImpl.BEFORE_PRI_29));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:StringPrep.java

示例6: normalize

import sun.text.Normalizer; //导入依赖的package包/类
private StringBuffer normalize(StringBuffer src){
    /*
     * Option UNORM_BEFORE_PRI_29:
     *
     * IDNA as interpreted by IETF members (see unicode mailing list 2004H1)
     * requires strict adherence to Unicode 3.2 normalization,
     * including buggy composition from before fixing Public Review Issue #29.
     * Note that this results in some valid but nonsensical text to be
     * either corrupted or rejected, depending on the text.
     * See http://www.unicode.org/review/resolved-pri.html#pri29
     * See unorm.cpp and cnormtst.c
     */
    return new StringBuffer(
        Normalizer.normalize(
            src.toString(),
            java.text.Normalizer.Form.NFKC,
            Normalizer.UNICODE_3_2));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:StringPrep.java

示例7: isAfterI

import sun.text.Normalizer; //导入依赖的package包/类
/**
    * Implements the "After_I" condition
    *
    * Specification: The last preceding base character was an uppercase I,
    * and there is no intervening combining character class 230 (ABOVE).
    *
    * Regular Expression: 
    *   Before C: [I]([{cc!=230}&{cc!=0}])*
    */
   private static boolean isAfterI(String src, int index) {
int ch;
int cc;

// Look for the last preceding base character
for (int i = index; i > 0; i -= Character.charCount(ch)) {

    ch = src.codePointBefore(i);

    if (ch == 'I') {
	return true;
    } else {
	cc = Normalizer.getCombiningClass(ch);
	if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) {
	    return false;
	}
    }
}

return false;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:31,代码来源:ConditionalSpecialCasing.java

示例8: isAfterSoftDotted

import sun.text.Normalizer; //导入依赖的package包/类
/**
    * Implements the "After_Soft_Dotted" condition
    *
    * Specification: The last preceding character with combining class
    * of zero before C was Soft_Dotted, and there is no intervening
    * combining character class 230 (ABOVE).
    *
    * Regular Expression: 
    *   Before C: [{Soft_Dotted==true}]([{cc!=230}&{cc!=0}])*
    */
   private static boolean isAfterSoftDotted(String src, int index) {
int ch;
int cc;

// Look for the last preceding character
for (int i = index; i > 0; i -= Character.charCount(ch)) {

    ch = src.codePointBefore(i);

    if (isSoftDotted(ch)) {
	return true;
    } else {
	cc = Normalizer.getCombiningClass(ch);
	if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) {
	    return false;
	}
    }
}

return false;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:32,代码来源:ConditionalSpecialCasing.java

示例9: isMoreAbove

import sun.text.Normalizer; //导入依赖的package包/类
/**
    * Implements the "More_Above" condition
    *
    * Specification: C is followed by one or more characters of combining
    * class 230 (ABOVE) in the combining character sequence.
    *
    * Regular Expression: 
    *   After C: [{cc!=0}]*[{cc==230}]
    */
   private static boolean isMoreAbove(String src, int index) {
int ch;
int cc;
int len = src.length();

// Look for a following ABOVE combining class character
for (int i = index + Character.charCount(src.codePointAt(index));
	i < len; i += Character.charCount(ch)) {
    
    ch = src.codePointAt(i);
    cc = Normalizer.getCombiningClass(ch);

    if (cc == COMBINING_CLASS_ABOVE) {
	return true;
    } else if (cc == 0) {
	return false;
    }
}

return false;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:31,代码来源:ConditionalSpecialCasing.java

示例10: isBeforeDot

import sun.text.Normalizer; //导入依赖的package包/类
/**
    * Implements the "Before_Dot" condition
    *
    * Specification: C is followed by <code>U+0307 COMBINING DOT ABOVE</code>.
    * Any sequence of characters with a combining class that is
    * neither 0 nor 230 may intervene between the current character
    * and the combining dot above.
    *
    * Regular Expression: 
    *   After C: ([{cc!=230}&{cc!=0}])*[\u0307]
    */
   private static boolean isBeforeDot(String src, int index) {
int ch;
int cc;
int len = src.length();

// Look for a following COMBINING DOT ABOVE
for (int i = index + Character.charCount(src.codePointAt(index));
	i < len; i += Character.charCount(ch)) {
    
    ch = src.codePointAt(i);

    if (ch == '\u0307') {
	return true;
    } else {
	cc = Normalizer.getCombiningClass(ch);
	if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) {
	    return false;
	}
    }
}

return false;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:35,代码来源:ConditionalSpecialCasing.java


注:本文中的sun.text.Normalizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。