System.Globalization.CharUnicodeInfo.InternalConvertToUtf32 C# (CSharp) Method

InternalConvertToUtf32() static private method

static private InternalConvertToUtf32 ( String s, int index ) : int
s String
index int
return int
        internal static int InternalConvertToUtf32(String s, int index) {
            BCLDebug.Assert(s != null, "s != null");
            BCLDebug.Assert(index >= 0 && index < s.Length, "index < s.Length");
            if (index < s.Length - 1) {
                int temp1 = (int)s[index] - HIGH_SURROGATE_START;
                if (temp1 >= 0 && temp1 <= 0x3ff) {
                    int temp2 = (int)s[index+1] - LOW_SURROGATE_START;
                    if (temp2 >= 0 && temp2 <= 0x3ff) {
                        // Convert the surrogate to UTF32 and get the result.
                        return ((temp1 * 0x400) + temp2 + UNICODE_PLANE01_START);
                    }
                }
            }
            return ((int)s[index]);
        }

Same methods

CharUnicodeInfo::InternalConvertToUtf32 ( String s, int index, int &charLength ) : int

Usage Example

Esempio n. 1
0
 internal static BidiCategory GetBidiCategory(string s, int index)
 {
     if (s == null)
     {
         throw new ArgumentNullException("s");
     }
     if ((uint)index >= (uint)s.Length)
     {
         throw new ArgumentOutOfRangeException("index");
     }
     return((BidiCategory)CharUnicodeInfo.InternalGetCategoryValue(CharUnicodeInfo.InternalConvertToUtf32(s, index), 1));
 }
All Usage Examples Of System.Globalization.CharUnicodeInfo::InternalConvertToUtf32