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

◆ StartsWithOrdinalIgnoreCaseHelper()

unsafe bool System.Globalization.CompareInfo.StartsWithOrdinalIgnoreCaseHelper ( ReadOnlySpan< char > source,
ReadOnlySpan< char > prefix,
CompareOptions options,
int * matchLengthPtr )
inlineprivate

Definition at line 1411 of file CompareInfo.cs.

1412 {
1413 int num = Math.Min(source.Length, prefix.Length);
1414 fixed (char* ptr = &MemoryMarshal.GetReference(source))
1415 {
1416 fixed (char* ptr3 = &MemoryMarshal.GetReference(prefix))
1417 {
1418 char* ptr2 = ptr;
1419 char* ptr4 = ptr3;
1420 while (true)
1421 {
1422 if (num != 0)
1423 {
1424 int num2 = *ptr2;
1425 int num3 = *ptr4;
1426 if (num2 >= 128 || num3 >= 128 || HighCharTable[num2] || HighCharTable[num3])
1427 {
1428 break;
1429 }
1430 if (num2 == num3)
1431 {
1432 ptr2++;
1433 ptr4++;
1434 num--;
1435 continue;
1436 }
1437 if ((uint)(num2 - 97) <= 25u)
1438 {
1439 num2 -= 32;
1440 }
1441 if ((uint)(num3 - 97) <= 25u)
1442 {
1443 num3 -= 32;
1444 }
1445 if (num2 == num3)
1446 {
1447 ptr2++;
1448 ptr4++;
1449 num--;
1450 continue;
1451 }
1452 if ((ptr2 < ptr + source.Length - 1 && ptr2[1] >= '\u0080') || (ptr4 < ptr3 + prefix.Length - 1 && ptr4[1] >= '\u0080'))
1453 {
1454 break;
1455 }
1456 return false;
1457 }
1458 if (source.Length < prefix.Length)
1459 {
1460 if (*ptr4 >= '\u0080')
1461 {
1462 break;
1463 }
1464 return false;
1465 }
1466 if (source.Length > prefix.Length && *ptr2 >= '\u0080')
1467 {
1468 break;
1469 }
1470 if (matchLengthPtr != null)
1471 {
1472 *matchLengthPtr = prefix.Length;
1473 }
1474 return true;
1475 }
1477 }
1478 }
1479 }
static unsafe bool StartsWith(IntPtr sortHandle, char *target, int cwTargetLength, char *source, int cwSourceLength, CompareOptions options, int *matchedLength)
static ReadOnlySpan< bool > HighCharTable

References System.Globalization.CompareInfo._sortHandle, System.Runtime.Serialization.Dictionary, System.Globalization.CompareInfo.HighCharTable, System.Math.Min(), System.options, System.prefix, System.source, and Interop.Globalization.StartsWith().

Referenced by System.Globalization.CompareInfo.IcuStartsWith().