159 {
161 {
163 {
164 char* ptr2 = ptr + (source.Length -
value.Length);
165 char* ptr4 = ptr3 + value.Length - 1;
166 for (char* ptr5 = ptr; ptr5 <= ptr2; ptr5++)
167 {
168 char* ptr6 = ptr3;
169 char* ptr7 = ptr5;
170 while (ptr6 <= ptr4)
171 {
172 if (!char.IsHighSurrogate(*ptr6) || ptr6 == ptr4)
173 {
175 {
176 break;
177 }
178 ptr6++;
179 ptr7++;
180 }
181 else if (char.IsHighSurrogate(*ptr7) && char.IsLowSurrogate(ptr7[1]) && char.IsLowSurrogate(ptr6[1]))
182 {
183 if (!SurrogateCasing.Equal(*ptr7, ptr7[1], *ptr6, ptr6[1]))
184 {
185 break;
186 }
187 ptr7 += 2;
188 ptr6 += 2;
189 }
190 else
191 {
192 if (*ptr6 != *ptr7)
193 {
194 break;
195 }
196 ptr7++;
197 ptr6++;
198 }
199 }
200 if (ptr6 > ptr4)
201 {
202 return (int)(ptr5 - ptr);
203 }
204 }
205 return -1;
206 }
207 }
208 }
static char ToUpper(char c)