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

◆ SplitInternal() [3/3]

string[] System.String.SplitInternal ( string separator,
string[] separators,
int count,
StringSplitOptions options )
inlineprivate

Definition at line 2675 of file String.cs.

2676 {
2677 if (count < 0)
2678 {
2679 throw new ArgumentOutOfRangeException("count", SR.ArgumentOutOfRange_NegativeCount);
2680 }
2682 bool flag = (object)separator != null;
2683 if (!flag && (separators == null || separators.Length == 0))
2684 {
2685 return SplitInternal(default(ReadOnlySpan<char>), count, options);
2686 }
2687 while (true)
2688 {
2689 if (count <= 1 || Length == 0)
2690 {
2691 string text = this;
2692 if ((options & StringSplitOptions.TrimEntries) != 0 && count > 0)
2693 {
2694 text = text.Trim();
2695 }
2696 if ((options & StringSplitOptions.RemoveEmptyEntries) != 0 && text.Length == 0)
2697 {
2698 count = 0;
2699 }
2700 if (count != 0)
2701 {
2702 return new string[1] { text };
2703 }
2704 return Array.Empty<string>();
2705 }
2706 if (!flag)
2707 {
2708 break;
2709 }
2710 if (separator.Length == 0)
2711 {
2712 count = 1;
2713 continue;
2714 }
2716 }
2717 Span<int> initialSpan = stackalloc int[128];
2719 initialSpan = stackalloc int[128];
2724 if (sepList.Length == 0)
2725 {
2726 return new string[1] { this };
2727 }
2729 sepListBuilder.Dispose();
2730 lengthListBuilder.Dispose();
2731 return result;
2732 }
string[] SplitWithPostProcessing(ReadOnlySpan< int > sepList, ReadOnlySpan< int > lengthList, int defaultLength, int count, StringSplitOptions options)
Definition String.cs:2785
string[] SplitWithoutPostProcessing(ReadOnlySpan< int > sepList, ReadOnlySpan< int > lengthList, int defaultLength, int count)
Definition String.cs:2758
static void CheckStringSplitOptions(StringSplitOptions options)
Definition String.cs:2984
unsafe void MakeSeparatorList(ReadOnlySpan< char > separators, ref ValueListBuilder< int > sepListBuilder)
Definition String.cs:2841
string[] SplitInternal(ReadOnlySpan< char > separators, int count, StringSplitOptions options)
Definition String.cs:2608

References System.SR.ArgumentOutOfRange_NegativeCount, System.String.CheckStringSplitOptions(), System.count, System.String.Length, System.String.MakeSeparatorList(), System.options, System.String.SplitInternal(), System.String.SplitWithoutPostProcessing(), System.String.SplitWithPostProcessing(), and System.text.