Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IndexOfIgnoreCase()

static unsafe int System.Globalization.InvariantModeCasing.IndexOfIgnoreCase ( ReadOnlySpan< char > source,
ReadOnlySpan< char > value )
inlinestaticpackage

Definition at line 191 of file InvariantModeCasing.cs.

192 {
193 fixed (char* ptr = &MemoryMarshal.GetReference(source))
194 {
195 fixed (char* ptr3 = &MemoryMarshal.GetReference(value))
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 {
207 if (*ptr6 != *ptr7 && ToUpper(*ptr6) != ToUpper(*ptr7))
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 }

References System.Globalization.SurrogateCasing.Equal(), System.source, System.Globalization.InvariantModeCasing.ToUpper(), and System.value.

Referenced by System.Globalization.Ordinal.IndexOfOrdinalIgnoreCase().