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

◆ IndexOf()

static int System.MemoryExtensions.IndexOf ( this ReadOnlySpan< char > span,
ReadOnlySpan< char > value,
StringComparison comparisonType )
inlinestatic

Definition at line 1437 of file MemoryExtensions.cs.

1438 {
1439 string.CheckStringComparison(comparisonType);
1440 switch (comparisonType)
1441 {
1442 case StringComparison.Ordinal:
1443 return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
1444 case StringComparison.CurrentCulture:
1445 case StringComparison.CurrentCultureIgnoreCase:
1446 return CultureInfo.CurrentCulture.CompareInfo.IndexOf(span, value, string.GetCaseCompareOfComparisonCulture(comparisonType));
1447 case StringComparison.InvariantCulture:
1448 case StringComparison.InvariantCultureIgnoreCase:
1449 return CompareInfo.Invariant.IndexOf(span, value, string.GetCaseCompareOfComparisonCulture(comparisonType));
1450 default:
1452 }
1453 }
static readonly CompareInfo Invariant
static CultureInfo CurrentCulture
static int IndexOfOrdinalIgnoreCase(ReadOnlySpan< char > source, ReadOnlySpan< char > value)
Definition Ordinal.cs:151

References System.comparisonType, System.Globalization.CultureInfo.CurrentCulture, System.SpanHelpers.IndexOf(), System.Globalization.Ordinal.IndexOfOrdinalIgnoreCase(), System.Globalization.CompareInfo.Invariant, and System.value.