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

◆ FindSection()

static unsafe int System.Globalization.FormatProvider.Number.FindSection ( ReadOnlySpan< char > format,
int section )
inlinestaticprivate

Definition at line 824 of file FormatProvider.cs.

825 {
826 if (section == 0)
827 {
828 return 0;
829 }
830 fixed (char* ptr = &MemoryMarshal.GetReference(format))
831 {
832 int num = 0;
833 while (true)
834 {
835 if (num >= format.Length)
836 {
837 return 0;
838 }
839 char c;
840 char c2 = (c = ptr[num++]);
841 if ((uint)c2 <= 34u)
842 {
843 if (c2 == '\0')
844 {
845 break;
846 }
847 if (c2 != '"')
848 {
849 continue;
850 }
851 }
852 else if (c2 != '\'')
853 {
854 switch (c2)
855 {
856 default:
857 continue;
858 case '\\':
859 if (num < format.Length && ptr[num] != 0)
860 {
861 num++;
862 }
863 continue;
864 case ';':
865 break;
866 }
867 if (--section == 0)
868 {
869 if (num >= format.Length || ptr[num] == '\0' || ptr[num] == ';')
870 {
871 break;
872 }
873 return num;
874 }
875 continue;
876 }
877 while (num < format.Length && ptr[num] != 0 && ptr[num++] != c)
878 {
879 }
880 }
881 return 0;
882 }
883 }

References System.format.

Referenced by System.Globalization.FormatProvider.Number.NumberToStringFormat().