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

◆ ConvertOldStringsToClass()

static string System.Text.RegularExpressions.RegexCharClass.ConvertOldStringsToClass ( string set,
string category )
inlinestatic

Definition at line 572 of file RegexCharClass.cs.

573 {
574 bool flag = set.Length >= 2 && set[0] == '\0' && set[1] == '\0';
575 int num = 3 + set.Length + category.Length;
576 if (flag)
577 {
578 num -= 2;
579 }
580 return string.Create(num, (set, category, flag), delegate(Span<char> span, (string set, string category, bool startsWithNulls) state)
581 {
582 int start;
583 if (state.startsWithNulls)
584 {
585 span[0] = '\u0001';
586 span[1] = (char)(state.set.Length - 2);
587 span[2] = (char)state.category.Length;
588 state.set.AsSpan(2).CopyTo(span.Slice(3));
589 start = 3 + state.set.Length - 2;
590 }
591 else
592 {
593 span[0] = '\0';
594 span[1] = (char)state.set.Length;
595 span[2] = (char)state.category.Length;
596 state.set.CopyTo(span.Slice(3));
597 start = 3 + state.set.Length;
598 }
599 state.category.CopyTo(span.Slice(start));
600 });
601 }
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)

References System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.start, and System.state.

Referenced by System.Text.RegularExpressions.RegexRunner.CharInSet().