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

◆ ToUpper() [3/3]

static string System.Globalization.InvariantModeCasing.ToUpper ( string s)
inlinestaticpackage

Definition at line 62 of file InvariantModeCasing.cs.

63 {
64 if (s.Length == 0)
65 {
66 return string.Empty;
67 }
68 ReadOnlySpan<char> readOnlySpan = s;
69 int num = 0;
70 while (num < s.Length)
71 {
72 if (char.IsHighSurrogate(readOnlySpan[num]) && num < s.Length - 1 && char.IsLowSurrogate(readOnlySpan[num + 1]))
73 {
74 SurrogateCasing.ToUpper(readOnlySpan[num], readOnlySpan[num + 1], out var hr, out var lr);
75 if (readOnlySpan[num] != hr || readOnlySpan[num + 1] != lr)
76 {
77 break;
78 }
79 num += 2;
80 }
81 else
82 {
83 if (ToUpper(readOnlySpan[num]) != readOnlySpan[num])
84 {
85 break;
86 }
87 num++;
88 }
89 }
90 if (num >= s.Length)
91 {
92 return s;
93 }
94 return string.Create(s.Length, (s, num), delegate(Span<char> destination, (string s, int i) state)
95 {
96 ReadOnlySpan<char> readOnlySpan2 = state.s;
97 readOnlySpan2.Slice(0, state.i).CopyTo(destination);
98 ToUpper(readOnlySpan2.Slice(state.i), destination.Slice(state.i));
99 });
100 }

References System.destination, System.s, System.ReadOnlySpan< T >.Slice(), System.state, System.Globalization.InvariantModeCasing.ToUpper(), and System.Globalization.SurrogateCasing.ToUpper().