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

◆ ToLower() [3/3]

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

Definition at line 22 of file InvariantModeCasing.cs.

23 {
24 if (s.Length == 0)
25 {
26 return string.Empty;
27 }
28 ReadOnlySpan<char> readOnlySpan = s;
29 int num = 0;
30 while (num < s.Length)
31 {
32 if (char.IsHighSurrogate(readOnlySpan[num]) && num < s.Length - 1 && char.IsLowSurrogate(readOnlySpan[num + 1]))
33 {
34 SurrogateCasing.ToLower(readOnlySpan[num], readOnlySpan[num + 1], out var hr, out var lr);
35 if (readOnlySpan[num] != hr || readOnlySpan[num + 1] != lr)
36 {
37 break;
38 }
39 num += 2;
40 }
41 else
42 {
43 if (ToLower(readOnlySpan[num]) != readOnlySpan[num])
44 {
45 break;
46 }
47 num++;
48 }
49 }
50 if (num >= s.Length)
51 {
52 return s;
53 }
54 return string.Create(s.Length, (s, num), delegate(Span<char> destination, (string s, int i) state)
55 {
56 ReadOnlySpan<char> readOnlySpan2 = state.s;
57 readOnlySpan2.Slice(0, state.i).CopyTo(destination);
58 ToLower(readOnlySpan2.Slice(state.i), destination.Slice(state.i));
59 });
60 }

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