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]);
}