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

◆ Split() [1/7]

static string[] System.Text.RegularExpressions.Regex.Split ( Regex regex,
string input,
int count,
int startat )
inlinestaticprivate

Definition at line 698 of file Regex.cs.

699 {
700 if (count < 0)
701 {
702 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.CountTooSmall);
703 }
704 if ((uint)startat > (uint)input.Length)
705 {
706 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startat, ExceptionResource.BeginIndexNotNegative);
707 }
708 if (count == 1)
709 {
710 return new string[1] { input };
711 }
712 count--;
713 (List<string>, int, string, int) state2 = (new List<string>(), 0, input, count);
714 if (!regex.RightToLeft)
715 {
717 {
718 state.results.Add(state.input.Substring(state.prevat, match.Index - state.prevat));
719 state.prevat = match.Index + match.Length;
720 for (int j = 1; j < match.Groups.Count; j++)
721 {
722 if (match.IsMatched(j))
723 {
724 state.results.Add(match.Groups[j].ToString());
725 }
726 }
727 return --state.count != 0;
728 }, reuseMatchObject: true);
729 if (state2.Item1.Count == 0)
730 {
731 return new string[1] { input };
732 }
733 state2.Item1.Add(input.Substring(state2.Item2, input.Length - state2.Item2));
734 }
735 else
736 {
737 state2.Item2 = input.Length;
739 {
740 state.results.Add(state.input.Substring(match.Index + match.Length, state.prevat - match.Index - match.Length));
741 state.prevat = match.Index;
742 for (int i = 1; i < match.Groups.Count; i++)
743 {
744 if (match.IsMatched(i))
745 {
746 state.results.Add(match.Groups[i].ToString());
747 }
748 }
749 return --state.count != 0;
750 }, reuseMatchObject: true);
751 if (state2.Item1.Count == 0)
752 {
753 return new string[1] { input };
754 }
755 state2.Item1.Add(input.Substring(0, state2.Item2));
756 state2.Item1.Reverse(0, state2.Item1.Count);
757 }
758 return state2.Item1.ToArray();
759 }
void Add(TKey key, TValue value)
static Match Match(string input, string pattern)
Definition Regex.cs:439

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Text.RegularExpressions.count, System.Runtime.Serialization.Dictionary, System.Text.RegularExpressions.i, System.Text.RegularExpressions.input, System.match, System.Text.RegularExpressions.startat, System.state, and System.Text.RegularExpressions.ThrowHelper.ThrowArgumentOutOfRangeException().