예제 #1
0
        public static uint ToUtf32(ushort leadingSurrogate, ushort trailingSurrogate)
        {
            if (!Utf16.IsLeadingSurrogate(leadingSurrogate))
            {
                throw InvalidLeadingSurrogate(leadingSurrogate);
            }

            if (!Utf16.IsTrailingSurrogate(trailingSurrogate))
            {
                throw InvalidTrailingSurrogate(trailingSurrogate);
            }

            return(CombineSurrogates(leadingSurrogate, trailingSurrogate));
        }
예제 #2
0
 public static bool IsInvalid(uint value)
 {
     return(((value & 0xFFFE) == 0xFFFE) ||
            (Utf16.IsSurrogate(value)) ||
            (value >= NonCharacterStart && value <= NonCharacterEnd));
 }