192 {
194 {
196 {
197 char* ptr2 = ptr + (source.Length -
value.Length);
198 char* ptr4 = ptr3 + value.Length - 1;
199 for (char* ptr5 = ptr; ptr5 <= ptr2; ptr5++)
200 {
201 char* ptr6 = ptr3;
202 char* ptr7 = ptr5;
203 while (ptr6 <= ptr4)
204 {
205 if (!char.IsHighSurrogate(*ptr6) || ptr6 == ptr4)
206 {
208 {
209 break;
210 }
211 ptr6++;
212 ptr7++;
213 }
214 else if (char.IsHighSurrogate(*ptr7) && char.IsLowSurrogate(ptr7[1]) && char.IsLowSurrogate(ptr6[1]))
215 {
216 if (!SurrogateCasing.Equal(*ptr7, ptr7[1], *ptr6, ptr6[1]))
217 {
218 break;
219 }
220 ptr7 += 2;
221 ptr6 += 2;
222 }
223 else
224 {
225 if (*ptr6 != *ptr7)
226 {
227 break;
228 }
229 ptr7++;
230 ptr6++;
231 }
232 }
233 if (ptr6 > ptr4)
234 {
235 return (int)(ptr5 - ptr);
236 }
237 }
238 return -1;
239 }
240 }
241 }
static char ToUpper(char c)