/// <summary> /// 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}])* /// </summary> private static bool 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); }
/// <summary> /// Implements the "Final_Cased" condition /// /// Specification: Within the closest word boundaries containing C, there is a cased /// letter before C, and there is no cased letter after C. /// /// Regular Expression: /// Before C: [{cased==true}][{wordBoundary!=true}]* /// After C: !([{wordBoundary!=true}]*[{cased}]) /// </summary> private static bool IsFinalCased(String src, int index, Locale locale) { BreakIterator wordBoundary = BreakIterator.GetWordInstance(locale); wordBoundary.SetText(src); int ch; // Look for a preceding 'cased' letter for (int i = index; (i >= 0) && !wordBoundary.IsBoundary(i); i -= Character.CharCount(ch)) { ch = src.CodePointBefore(i); if (IsCased(ch)) { int len = src.Length(); // Check that there is no 'cased' letter after the index for (i = index + Character.CharCount(src.CodePointAt(index)); (i < len) && !wordBoundary.IsBoundary(i); i += Character.CharCount(ch)) { ch = src.CodePointAt(i); if (IsCased(ch)) { return(false); } } return(true); } } return(false); }