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

◆ SplitWithPostProcessing()

string[] System.String.SplitWithPostProcessing ( ReadOnlySpan< int > sepList,
ReadOnlySpan< int > lengthList,
int defaultLength,
int count,
StringSplitOptions options )
inlineprivate

Definition at line 2785 of file String.cs.

2786 {
2787 int length = sepList.Length;
2788 int num = ((length < count) ? (length + 1) : count);
2789 string[] array = new string[num];
2790 int num2 = 0;
2791 int num3 = 0;
2793 for (int i = 0; i < length; i++)
2794 {
2795 span = this.AsSpan(num2, sepList[i] - num2);
2796 if ((options & StringSplitOptions.TrimEntries) != 0)
2797 {
2798 span = span.Trim();
2799 }
2800 if (!span.IsEmpty || (options & StringSplitOptions.RemoveEmptyEntries) == 0)
2801 {
2802 array[num3++] = span.ToString();
2803 }
2804 num2 = sepList[i] + (lengthList.IsEmpty ? defaultLength : lengthList[i]);
2805 if (num3 != count - 1)
2806 {
2807 continue;
2808 }
2809 if ((options & StringSplitOptions.RemoveEmptyEntries) == 0)
2810 {
2811 break;
2812 }
2813 while (++i < length)
2814 {
2815 span = this.AsSpan(num2, sepList[i] - num2);
2816 if ((options & StringSplitOptions.TrimEntries) != 0)
2817 {
2818 span = span.Trim();
2819 }
2820 if (!span.IsEmpty)
2821 {
2822 break;
2823 }
2824 num2 = sepList[i] + (lengthList.IsEmpty ? defaultLength : lengthList[i]);
2825 }
2826 break;
2827 }
2828 span = this.AsSpan(num2);
2829 if ((options & StringSplitOptions.TrimEntries) != 0)
2830 {
2831 span = span.Trim();
2832 }
2833 if (!span.IsEmpty || (options & StringSplitOptions.RemoveEmptyEntries) == 0)
2834 {
2835 array[num3++] = span.ToString();
2836 }
2837 Array.Resize(ref array, num3);
2838 return array;
2839 }

References System.array, System.count, System.length, and System.options.

Referenced by System.String.SplitInternal(), System.String.SplitInternal(), and System.String.SplitInternal().