Is High/Low Surrogate - CSharp System

CSharp examples for System:Char

Description

Is High/Low Surrogate

Demo Code



namespace LinqToTwitter.Common
{
    public static class CharExtensions
    {//from w ww.  j  a va2s.  c  o  m
        internal const char HighSurrogateStart = '\ud800';
        internal const char HighSurrogateEnd = '\udbff';
        internal const char LowSurrogateStart = '\udc00';
        internal const char LowSurrogateEnd = '\udfff';

        public static bool IsHighSurrogate(this char c)
        {
            return ((c >= HighSurrogateStart) && (c <= HighSurrogateEnd));
        }

        public static bool IsLowSurrogate(this char c)
        {
            return ((c >= LowSurrogateStart) && (c <= LowSurrogateEnd));
        }
    }
}

Related Tutorials