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

◆ LastIndexOf() [9/15]

int System.Globalization.CompareInfo.LastIndexOf ( string source,
char value,
int startIndex,
int count,
CompareOptions options )
inline

Definition at line 856 of file CompareInfo.cs.

857 {
858 if (source == null)
859 {
860 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
861 }
862 while ((uint)startIndex >= (uint)source.Length)
863 {
864 if (startIndex == -1 && source.Length == 0)
865 {
866 count = 0;
867 break;
868 }
869 if (startIndex == source.Length)
870 {
871 startIndex--;
872 if (count > 0)
873 {
874 count--;
875 }
876 continue;
877 }
878 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
879 break;
880 }
882 if (!source.TryGetSpan(startIndex, count, out var slice))
883 {
884 ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
885 }
886 int num = LastIndexOf(slice, MemoryMarshal.CreateReadOnlySpan(ref value, 1), options);
887 if (num >= 0)
888 {
889 num += startIndex;
890 }
891 return num;
892 }
int LastIndexOf(string source, char value)

References System.count, System.Globalization.CompareInfo.LastIndexOf(), System.options, System.source, System.startIndex, System.ThrowHelper.ThrowArgumentNullException(), System.ThrowHelper.ThrowArgumentOutOfRangeException(), System.ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count(), and System.value.