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

◆ ChangeCaseCultureAware()

static Rune System.Text.Rune.ChangeCaseCultureAware ( Rune rune,
TextInfo textInfo,
bool toUpper )
inlinestaticprivate

Definition at line 141 of file Rune.cs.

142 {
143 Span<char> span = stackalloc char[2];
144 Span<char> destination = stackalloc char[2];
145 int length = rune.EncodeToUtf16(span);
146 span = span.Slice(0, length);
147 destination = destination.Slice(0, length);
148 if (toUpper)
149 {
150 textInfo.ChangeCaseToUpper(span, destination);
151 }
152 else
153 {
154 textInfo.ChangeCaseToLower(span, destination);
155 }
156 if (rune.IsBmp)
157 {
158 return UnsafeCreate(destination[0]);
159 }
160 return UnsafeCreate(UnicodeUtility.GetScalarFromUtf16SurrogatePair(destination[0], destination[1]));
161 }
void ChangeCaseToLower(ReadOnlySpan< char > source, Span< char > destination)
Definition TextInfo.cs:203
void ChangeCaseToUpper(ReadOnlySpan< char > source, Span< char > destination)
Definition TextInfo.cs:209
static Rune UnsafeCreate(uint scalarValue)
Definition Rune.cs:643

References System.Globalization.TextInfo.ChangeCaseToLower(), System.Globalization.TextInfo.ChangeCaseToUpper(), System.destination, System.Text.Rune.EncodeToUtf16(), System.Text.UnicodeUtility.GetScalarFromUtf16SurrogatePair(), System.Text.Rune.IsBmp, System.length, System.Span< T >.Slice(), and System.Text.Rune.UnsafeCreate().

Referenced by System.Text.Rune.ToLower(), System.Text.Rune.ToLowerInvariant(), System.Text.Rune.ToUpper(), and System.Text.Rune.ToUpperInvariant().