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

◆ IndexOf() [3/16]

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

Definition at line 743 of file CompareInfo.cs.

744 {
745 *matchLengthPtr = 0;
746 int num = 0;
747 if ((options & ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth)) == 0)
748 {
749 if (!GlobalizationMode.Invariant)
750 {
751 if (value.IsEmpty)
752 {
753 if (!fromBeginning)
754 {
755 return source.Length;
756 }
757 return 0;
758 }
760 }
761 num = (((options & CompareOptions.IgnoreCase) != 0) ? (fromBeginning ? Ordinal.IndexOfOrdinalIgnoreCase(source, value) : Ordinal.LastIndexOfOrdinalIgnoreCase(source, value)) : (fromBeginning ? source.IndexOf(value) : source.LastIndexOf(value)));
762 }
763 else
764 {
765 switch (options)
766 {
767 case CompareOptions.Ordinal:
768 num = (fromBeginning ? source.IndexOf(value) : source.LastIndexOf(value));
769 break;
770 case CompareOptions.OrdinalIgnoreCase:
771 num = (fromBeginning ? Ordinal.IndexOfOrdinalIgnoreCase(source, value) : Ordinal.LastIndexOfOrdinalIgnoreCase(source, value));
772 break;
773 default:
774 ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidFlag, ExceptionArgument.options);
775 break;
776 }
777 }
778 if (num >= 0)
779 {
780 *matchLengthPtr = value.Length;
781 }
782 return num;
783 }
int LastIndexOf(string source, char value)
unsafe int IndexOfCore(ReadOnlySpan< char > source, ReadOnlySpan< char > target, CompareOptions options, int *matchLengthPtr, bool fromBeginning)
int IndexOf(string source, char value)

References System.Globalization.CompareInfo.IndexOfCore(), System.Globalization.Ordinal.IndexOfOrdinalIgnoreCase(), System.Globalization.GlobalizationMode.Invariant, System.Globalization.Ordinal.LastIndexOfOrdinalIgnoreCase(), System.options, System.source, System.ThrowHelper.ThrowArgumentException(), and System.value.