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

◆ ChangeCaseCommon< TConversion >() [3/3]

unsafe string System.Globalization.TextInfo.ChangeCaseCommon< TConversion > ( string source)
inlineprivate
Type Constraints
TConversion :struct 

Definition at line 299 of file TextInfo.cs.

299 : struct
300 {
301 bool flag = typeof(TConversion) == typeof(ToUpperConversion);
302 if (source.Length == 0)
303 {
304 return string.Empty;
305 }
306 fixed (char* ptr = source)
307 {
308 nuint num = 0u;
310 {
311 if (source.Length < 2)
312 {
313 goto IL_0095;
314 }
315 nuint num2 = (uint)(source.Length - 2);
316 while (true)
317 {
318 uint value = Unsafe.ReadUnaligned<uint>(ptr + num);
320 {
321 break;
322 }
324 {
325 num += 2;
326 if (num <= num2)
327 {
328 continue;
329 }
330 goto IL_0095;
331 }
332 goto IL_00d1;
333 }
334 }
335 goto IL_0121;
336 IL_0121:
337 string text = string.FastAllocateString(source.Length);
338 if (num != 0)
339 {
340 Span<char> destination = new Span<char>(ref text.GetRawStringData(), text.Length);
341 source.AsSpan(0, (int)num).CopyTo(destination);
342 }
343 fixed (char* ptr2 = text)
344 {
345 ChangeCaseCore(ptr + num, source.Length - (int)num, ptr2 + num, text.Length - (int)num, flag);
346 }
347 return text;
348 IL_0095:
349 if (((uint)source.Length & (true ? 1u : 0u)) != 0)
350 {
351 uint num3 = ptr[num];
352 if (num3 > 127)
353 {
354 goto IL_0121;
355 }
356 if (flag ? (num3 - 97 <= 25) : (num3 - 65 <= 25))
357 {
358 goto IL_00d1;
359 }
360 }
361 return source;
362 IL_00d1:
363 string text2 = string.FastAllocateString(source.Length);
364 Span<char> destination2 = new Span<char>(ref text2.GetRawStringData(), text2.Length);
365 source.AsSpan(0, (int)num).CopyTo(destination2);
366 ChangeCaseCommon<TConversion>(source.AsSpan((int)num), destination2.Slice((int)num));
367 return text2;
368 }
369 }
unsafe void ChangeCaseCore(char *src, int srcLen, char *dstBuffer, int dstBufferCapacity, bool bToUpper)
Definition TextInfo.cs:651
void ChangeCaseCommon< TConversion >(ReadOnlySpan< char > source, Span< char > destination)
Definition TextInfo.cs:215
static bool AllCharsInUInt32AreAscii(uint value)
static bool UInt32ContainsAnyUppercaseAsciiChar(uint value)
static bool UInt32ContainsAnyLowercaseAsciiChar(uint value)

References System.Text.Unicode.Utf16Utility.AllCharsInUInt32AreAscii(), System.Globalization.TextInfo.ChangeCaseCommon< TConversion >(), System.Globalization.TextInfo.ChangeCaseCore(), System.destination, System.Runtime.Serialization.Dictionary, System.Globalization.TextInfo.IsAsciiCasingSameAsInvariant, System.source, System.text, System.Text.Unicode.Utf16Utility.UInt32ContainsAnyLowercaseAsciiChar(), System.Text.Unicode.Utf16Utility.UInt32ContainsAnyUppercaseAsciiChar(), and System.value.