private boolean isFCD(CharSequence s) { return fcd.isNormalized(s); }
/** * {@inheritDoc} * @stable ICU 4.4 */ @Override public boolean isNormalized(CharSequence s) { UnicodeSet.SpanCondition spanCondition=UnicodeSet.SpanCondition.SIMPLE; for(int prevSpanLimit=0; prevSpanLimit<s.length();) { int spanLimit=set.span(s, prevSpanLimit, spanCondition); if(spanCondition==UnicodeSet.SpanCondition.NOT_CONTAINED) { spanCondition=UnicodeSet.SpanCondition.SIMPLE; } else { if(!norm2.isNormalized(s.subSequence(prevSpanLimit, spanLimit))) { return false; } spanCondition=UnicodeSet.SpanCondition.NOT_CONTAINED; } prevSpanLimit=spanLimit; } return true; }
/** * Test if a string is in a given normalization form. * This is semantically equivalent to source.equals(normalize(source, mode)). * * Unlike quickCheck(), this function returns a definitive result, * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will * perform further tests to arrive at a true/false result. * @param str the input string to be checked to see if it is * normalized * @param mode the normalization mode * @param options Options for use with exclusion set and tailored Normalization * The only option that is currently recognized is UNICODE_3_2 * @see #isNormalized * @deprecated ICU 56 Use {@link Normalizer2} instead. */ @Deprecated public static boolean isNormalized(String str, Mode mode, int options) { return mode.getNormalizer2(options).isNormalized(str); }
/** * Test if a string is in a given normalization form. * This is semantically equivalent to source.equals(normalize(source, mode)). * * Unlike quickCheck(), this function returns a definitive result, * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will * perform further tests to arrive at a true/false result. * @param src The input array of characters to be checked to see if * it is normalized * @param start The strart index in the source * @param limit The limit index in the source * @param mode the normalization mode * @param options Options for use with exclusion set and tailored Normalization * The only option that is currently recognized is UNICODE_3_2 * @return Boolean value indicating whether the source string is in the * "mode" normalization form * @deprecated ICU 56 Use {@link Normalizer2} instead. */ @Deprecated public static boolean isNormalized(char[] src,int start, int limit, Mode mode, int options) { CharBuffer srcBuffer = CharBuffer.wrap(src, start, limit - start); return mode.getNormalizer2(options).isNormalized(srcBuffer); }
newNFDString.append(decomp, decompIndex, decomp.length()); assert(nfd.isNormalized(newNFDString)); assert(fcd.isNormalized(newString)); assert(nfd.normalize(newString).equals(newNFDString.toString())); // canonically equivalent return true;
boolean isValid=uts46Norm2.isNormalized(fromPunycode); if(!isValid) { addLabelError(info, Error.INVALID_ACE_LABEL);