Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Rune.cs
Go to the documentation of this file.
7
8namespace System.Text;
9
10[DebuggerDisplay("{DebuggerDisplay,nq}")]
11public readonly struct Rune : IComparable, IComparable<Rune>, IEquatable<Rune>, ISpanFormattable, IFormattable
12{
13 private readonly uint _value;
14
15 private static ReadOnlySpan<byte> AsciiCharInfo => new byte[128]
16 {
17 14, 14, 14, 14, 14, 14, 14, 14, 14, 142,
18 142, 142, 142, 142, 14, 14, 14, 14, 14, 14,
19 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
20 14, 14, 139, 24, 24, 24, 26, 24, 24, 24,
21 20, 21, 24, 25, 24, 19, 24, 24, 72, 72,
22 72, 72, 72, 72, 72, 72, 72, 72, 24, 24,
23 25, 25, 25, 24, 24, 64, 64, 64, 64, 64,
24 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
25 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
26 64, 20, 24, 21, 27, 18, 27, 65, 65, 65,
27 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
28 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
29 65, 65, 65, 20, 25, 21, 25, 14
30 };
31
32 private string DebuggerDisplay
33 {
34 get
35 {
37 DefaultInterpolatedStringHandler handler = new DefaultInterpolatedStringHandler(5, 2, invariantCulture);
38 handler.AppendLiteral("U+");
39 handler.AppendFormatted(_value, "X4");
40 handler.AppendLiteral(" '");
41 handler.AppendFormatted(IsValid(_value) ? ToString() : "\ufffd");
42 handler.AppendLiteral("'");
43 return string.Create(invariantCulture, ref handler);
44 }
45 }
46
48
50
52
53 public static Rune ReplacementChar => UnsafeCreate(65533u);
54
56
58
59 public int Value => (int)_value;
60
69
70 public Rune(char highSurrogate, char lowSurrogate)
71 : this((uint)char.ConvertToUtf32(highSurrogate, lowSurrogate), unused: false)
72 {
73 }
74
75 public Rune(int value)
76 : this((uint)value)
77 {
78 }
79
80 [CLSCompliant(false)]
89
90 private Rune(uint scalarValue, bool unused)
91 {
92 _value = scalarValue;
93 }
94
95 public static bool operator ==(Rune left, Rune right)
96 {
97 return left._value == right._value;
98 }
99
100 public static bool operator !=(Rune left, Rune right)
101 {
102 return left._value != right._value;
103 }
104
105 public static bool operator <(Rune left, Rune right)
106 {
107 return left._value < right._value;
108 }
109
110 public static bool operator <=(Rune left, Rune right)
111 {
112 return left._value <= right._value;
113 }
114
115 public static bool operator >(Rune left, Rune right)
116 {
117 return left._value > right._value;
118 }
119
120 public static bool operator >=(Rune left, Rune right)
121 {
122 return left._value >= right._value;
123 }
124
125 public static explicit operator Rune(char ch)
126 {
127 return new Rune(ch);
128 }
129
130 [CLSCompliant(false)]
131 public static explicit operator Rune(uint value)
132 {
133 return new Rune(value);
134 }
135
136 public static explicit operator Rune(int value)
137 {
138 return new Rune(value);
139 }
140
141 private static Rune ChangeCaseCultureAware(Rune rune, TextInfo textInfo, bool toUpper)
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 }
161 }
162
163 public int CompareTo(Rune other)
164 {
165 return Value - other.Value;
166 }
167
168 public static OperationStatus DecodeFromUtf16(ReadOnlySpan<char> source, out Rune result, out int charsConsumed)
169 {
170 if (!source.IsEmpty)
171 {
172 char c = source[0];
173 if (TryCreate(c, out result))
174 {
175 charsConsumed = 1;
176 return OperationStatus.Done;
177 }
178 if (source.Length > 1)
179 {
180 char lowSurrogate = source[1];
181 if (TryCreate(c, lowSurrogate, out result))
182 {
183 charsConsumed = 2;
184 return OperationStatus.Done;
185 }
186 }
187 else if (char.IsHighSurrogate(c))
188 {
189 goto IL_004c;
190 }
191 charsConsumed = 1;
192 result = ReplacementChar;
193 return OperationStatus.InvalidData;
194 }
195 goto IL_004c;
196 IL_004c:
197 charsConsumed = source.Length;
198 result = ReplacementChar;
199 return OperationStatus.NeedMoreData;
200 }
201
202 public static OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> source, out Rune result, out int bytesConsumed)
203 {
204 int num = 0;
205 uint num2;
206 if ((uint)num < (uint)source.Length)
207 {
208 num2 = source[num];
210 {
211 goto IL_0021;
212 }
213 if (UnicodeUtility.IsInRangeInclusive(num2, 194u, 244u))
214 {
215 num2 = num2 - 194 << 6;
216 num++;
217 if ((uint)num >= (uint)source.Length)
218 {
219 goto IL_0163;
220 }
221 int num3 = (sbyte)source[num];
222 if (num3 < -64)
223 {
224 num2 += (uint)num3;
225 num2 += 128;
226 num2 += 128;
227 if (num2 < 2048)
228 {
229 goto IL_0021;
230 }
231 if (UnicodeUtility.IsInRangeInclusive(num2, 2080u, 3343u) && !UnicodeUtility.IsInRangeInclusive(num2, 2912u, 2943u) && !UnicodeUtility.IsInRangeInclusive(num2, 3072u, 3087u))
232 {
233 num++;
234 if ((uint)num >= (uint)source.Length)
235 {
236 goto IL_0163;
237 }
238 num3 = (sbyte)source[num];
239 if (num3 < -64)
240 {
241 num2 <<= 6;
242 num2 += (uint)num3;
243 num2 += 128;
244 num2 -= 131072;
245 if (num2 > 65535)
246 {
247 num++;
248 if ((uint)num >= (uint)source.Length)
249 {
250 goto IL_0163;
251 }
252 num3 = (sbyte)source[num];
253 if (num3 >= -64)
254 {
255 goto IL_0153;
256 }
257 num2 <<= 6;
258 num2 += (uint)num3;
259 num2 += 128;
260 num2 -= 4194304;
261 }
262 goto IL_0021;
263 }
264 }
265 }
266 }
267 else
268 {
269 num = 1;
270 }
271 goto IL_0153;
272 }
273 goto IL_0163;
274 IL_0021:
275 bytesConsumed = num + 1;
276 result = UnsafeCreate(num2);
277 return OperationStatus.Done;
278 IL_0163:
279 bytesConsumed = num;
280 result = ReplacementChar;
281 return OperationStatus.NeedMoreData;
282 IL_0153:
283 bytesConsumed = num;
284 result = ReplacementChar;
285 return OperationStatus.InvalidData;
286 }
287
288 public static OperationStatus DecodeLastFromUtf16(ReadOnlySpan<char> source, out Rune result, out int charsConsumed)
289 {
290 int num = source.Length - 1;
291 if ((uint)num < (uint)source.Length)
292 {
293 char c = source[num];
294 if (TryCreate(c, out result))
295 {
296 charsConsumed = 1;
297 return OperationStatus.Done;
298 }
299 if (char.IsLowSurrogate(c))
300 {
301 num--;
302 if ((uint)num < (uint)source.Length)
303 {
304 char highSurrogate = source[num];
305 if (TryCreate(highSurrogate, c, out result))
306 {
307 charsConsumed = 2;
308 return OperationStatus.Done;
309 }
310 }
311 charsConsumed = 1;
312 result = ReplacementChar;
313 return OperationStatus.InvalidData;
314 }
315 }
316 charsConsumed = -source.Length >>> 31;
317 result = ReplacementChar;
318 return OperationStatus.NeedMoreData;
319 }
320
321 public static OperationStatus DecodeLastFromUtf8(ReadOnlySpan<byte> source, out Rune value, out int bytesConsumed)
322 {
323 int num = source.Length - 1;
324 if ((uint)num < (uint)source.Length)
325 {
326 uint num2 = source[num];
328 {
329 bytesConsumed = 1;
330 value = UnsafeCreate(num2);
331 return OperationStatus.Done;
332 }
333 if (((byte)num2 & 0x40u) != 0)
334 {
335 return DecodeFromUtf8(source.Slice(num), out value, out bytesConsumed);
336 }
337 int num3 = 3;
338 OperationStatus result2;
339 Rune result;
340 int bytesConsumed2;
341 while (true)
342 {
343 if (num3 > 0)
344 {
345 num--;
346 if ((uint)num < (uint)source.Length)
347 {
348 if ((sbyte)source[num] < -64)
349 {
350 num3--;
351 continue;
352 }
353 source = source.Slice(num);
354 result2 = DecodeFromUtf8(source, out result, out bytesConsumed2);
355 if (bytesConsumed2 == source.Length)
356 {
357 break;
358 }
359 }
360 }
362 bytesConsumed = 1;
363 return OperationStatus.InvalidData;
364 }
365 bytesConsumed = bytesConsumed2;
366 value = result;
367 return result2;
368 }
370 bytesConsumed = 0;
371 return OperationStatus.NeedMoreData;
372 }
373
375 {
376 if (!TryEncodeToUtf16(destination, out var charsWritten))
377 {
379 }
380 return charsWritten;
381 }
382
384 {
385 if (!TryEncodeToUtf8(destination, out var bytesWritten))
386 {
388 }
389 return bytesWritten;
390 }
391
392 public override bool Equals([NotNullWhen(true)] object? obj)
393 {
394 if (obj is Rune other)
395 {
396 return Equals(other);
397 }
398 return false;
399 }
400
401 public bool Equals(Rune other)
402 {
403 return this == other;
404 }
405
406 public override int GetHashCode()
407 {
408 return Value;
409 }
410
411 public static Rune GetRuneAt(string input, int index)
412 {
413 int num = ReadRuneFromString(input, index);
414 if (num < 0)
415 {
417 }
418 return UnsafeCreate((uint)num);
419 }
420
421 public static bool IsValid(int value)
422 {
423 return IsValid((uint)value);
424 }
425
426 [CLSCompliant(false)]
427 public static bool IsValid(uint value)
428 {
430 }
431
433 {
434 if (input.IsEmpty)
435 {
436 return -1;
437 }
438 uint num = input[0];
440 {
442 {
443 return -1;
444 }
445 if (input.Length <= 1)
446 {
447 return -1;
448 }
449 uint num2 = input[1];
451 {
452 return -1;
453 }
455 }
456 return (int)num;
457 }
458
459 private static int ReadRuneFromString(string input, int index)
460 {
461 if (input == null)
462 {
464 }
465 if ((uint)index >= (uint)input.Length)
466 {
468 }
469 uint num = input[index];
471 {
473 {
474 return -1;
475 }
476 index++;
477 if ((uint)index >= (uint)input.Length)
478 {
479 return -1;
480 }
481 uint num2 = input[index];
483 {
484 return -1;
485 }
487 }
488 return (int)num;
489 }
490
491 public override string ToString()
492 {
493 if (IsBmp)
494 {
495 return string.CreateFromChar((char)_value);
496 }
497 UnicodeUtility.GetUtf16SurrogatesFromSupplementaryPlaneScalar(_value, out var highSurrogateCodePoint, out var lowSurrogateCodePoint);
498 return string.CreateFromChar(highSurrogateCodePoint, lowSurrogateCodePoint);
499 }
500
502 {
503 return TryEncodeToUtf16(destination, out charsWritten);
504 }
505
506 string IFormattable.ToString(string format, IFormatProvider formatProvider)
507 {
508 return ToString();
509 }
510
511 public static bool TryCreate(char ch, out Rune result)
512 {
514 {
515 result = UnsafeCreate(ch);
516 return true;
517 }
518 result = default(Rune);
519 return false;
520 }
521
522 public static bool TryCreate(char highSurrogate, char lowSurrogate, out Rune result)
523 {
524 uint num = (uint)(highSurrogate - 55296);
525 uint num2 = (uint)(lowSurrogate - 56320);
526 if ((num | num2) <= 1023)
527 {
528 result = UnsafeCreate((uint)((int)(num << 10) + (lowSurrogate - 56320) + 65536));
529 return true;
530 }
531 result = default(Rune);
532 return false;
533 }
534
535 public static bool TryCreate(int value, out Rune result)
536 {
537 return TryCreate((uint)value, out result);
538 }
539
540 [CLSCompliant(false)]
541 public static bool TryCreate(uint value, out Rune result)
542 {
544 {
545 result = UnsafeCreate(value);
546 return true;
547 }
548 result = default(Rune);
549 return false;
550 }
551
552 [MethodImpl(MethodImplOptions.AggressiveInlining)]
553 public bool TryEncodeToUtf16(Span<char> destination, out int charsWritten)
554 {
555 return TryEncodeToUtf16(this, destination, out charsWritten);
556 }
557
558 private static bool TryEncodeToUtf16(Rune value, Span<char> destination, out int charsWritten)
559 {
560 if (!destination.IsEmpty)
561 {
562 if (value.IsBmp)
563 {
564 destination[0] = (char)value._value;
565 charsWritten = 1;
566 return true;
567 }
568 if (1u < (uint)destination.Length)
569 {
571 charsWritten = 2;
572 return true;
573 }
574 }
575 charsWritten = 0;
576 return false;
577 }
578
579 [MethodImpl(MethodImplOptions.AggressiveInlining)]
580 public bool TryEncodeToUtf8(Span<byte> destination, out int bytesWritten)
581 {
582 return TryEncodeToUtf8(this, destination, out bytesWritten);
583 }
584
585 private static bool TryEncodeToUtf8(Rune value, Span<byte> destination, out int bytesWritten)
586 {
587 if (!destination.IsEmpty)
588 {
589 if (value.IsAscii)
590 {
591 destination[0] = (byte)value._value;
592 bytesWritten = 1;
593 return true;
594 }
595 if (1u < (uint)destination.Length)
596 {
597 if ((long)value.Value <= 2047L)
598 {
599 destination[0] = (byte)(value._value + 12288 >> 6);
600 destination[1] = (byte)((value._value & 0x3F) + 128);
601 bytesWritten = 2;
602 return true;
603 }
604 if (2u < (uint)destination.Length)
605 {
606 if ((long)value.Value <= 65535L)
607 {
608 destination[0] = (byte)(value._value + 917504 >> 12);
609 destination[1] = (byte)(((value._value & 0xFC0) >> 6) + 128);
610 destination[2] = (byte)((value._value & 0x3F) + 128);
611 bytesWritten = 3;
612 return true;
613 }
614 if (3u < (uint)destination.Length)
615 {
616 destination[0] = (byte)(value._value + 62914560 >> 18);
617 destination[1] = (byte)(((value._value & 0x3F000) >> 12) + 128);
618 destination[2] = (byte)(((value._value & 0xFC0) >> 6) + 128);
619 destination[3] = (byte)((value._value & 0x3F) + 128);
620 bytesWritten = 4;
621 return true;
622 }
623 }
624 }
625 }
626 bytesWritten = 0;
627 return false;
628 }
629
630 public static bool TryGetRuneAt(string input, int index, out Rune value)
631 {
632 int num = ReadRuneFromString(input, index);
633 if (num >= 0)
634 {
635 value = UnsafeCreate((uint)num);
636 return true;
637 }
638 value = default(Rune);
639 return false;
640 }
641
642 [MethodImpl(MethodImplOptions.AggressiveInlining)]
643 internal static Rune UnsafeCreate(uint scalarValue)
644 {
645 return new Rune(scalarValue, unused: false);
646 }
647
648 public static double GetNumericValue(Rune value)
649 {
650 if (value.IsAscii)
651 {
652 uint num = value._value - 48;
653 if (num > 9)
654 {
655 return -1.0;
656 }
657 return num;
658 }
660 }
661
663 {
664 if (value.IsAscii)
665 {
666 return (UnicodeCategory)(AsciiCharInfo[value.Value] & 0x1F);
667 }
669 }
670
675
676 private static bool IsCategoryLetter(UnicodeCategory category)
677 {
678 return UnicodeUtility.IsInRangeInclusive((uint)category, 0u, 4u);
679 }
680
682 {
683 if (!UnicodeUtility.IsInRangeInclusive((uint)category, 0u, 4u))
684 {
685 return category == UnicodeCategory.DecimalDigitNumber;
686 }
687 return true;
688 }
689
690 private static bool IsCategoryNumber(UnicodeCategory category)
691 {
692 return UnicodeUtility.IsInRangeInclusive((uint)category, 8u, 10u);
693 }
694
695 private static bool IsCategoryPunctuation(UnicodeCategory category)
696 {
697 return UnicodeUtility.IsInRangeInclusive((uint)category, 18u, 24u);
698 }
699
700 private static bool IsCategorySeparator(UnicodeCategory category)
701 {
702 return UnicodeUtility.IsInRangeInclusive((uint)category, 11u, 13u);
703 }
704
705 private static bool IsCategorySymbol(UnicodeCategory category)
706 {
707 return UnicodeUtility.IsInRangeInclusive((uint)category, 25u, 28u);
708 }
709
710 public static bool IsControl(Rune value)
711 {
712 return ((value._value + 1) & 0xFFFFFF7Fu) <= 32;
713 }
714
715 public static bool IsDigit(Rune value)
716 {
717 if (value.IsAscii)
718 {
719 return UnicodeUtility.IsInRangeInclusive(value._value, 48u, 57u);
720 }
721 return GetUnicodeCategoryNonAscii(value) == UnicodeCategory.DecimalDigitNumber;
722 }
723
724 public static bool IsLetter(Rune value)
725 {
726 if (value.IsAscii)
727 {
728 return ((value._value - 65) & 0xFFFFFFDFu) <= 25;
729 }
731 }
732
733 public static bool IsLetterOrDigit(Rune value)
734 {
735 if (value.IsAscii)
736 {
737 return (AsciiCharInfo[value.Value] & 0x40) != 0;
738 }
740 }
741
742 public static bool IsLower(Rune value)
743 {
744 if (value.IsAscii)
745 {
746 return UnicodeUtility.IsInRangeInclusive(value._value, 97u, 122u);
747 }
748 return GetUnicodeCategoryNonAscii(value) == UnicodeCategory.LowercaseLetter;
749 }
750
751 public static bool IsNumber(Rune value)
752 {
753 if (value.IsAscii)
754 {
755 return UnicodeUtility.IsInRangeInclusive(value._value, 48u, 57u);
756 }
758 }
759
760 public static bool IsPunctuation(Rune value)
761 {
763 }
764
765 public static bool IsSeparator(Rune value)
766 {
768 }
769
770 public static bool IsSymbol(Rune value)
771 {
773 }
774
775 public static bool IsUpper(Rune value)
776 {
777 if (value.IsAscii)
778 {
779 return UnicodeUtility.IsInRangeInclusive(value._value, 65u, 90u);
780 }
781 return GetUnicodeCategoryNonAscii(value) == UnicodeCategory.UppercaseLetter;
782 }
783
784 public static bool IsWhiteSpace(Rune value)
785 {
786 if (value.IsAscii)
787 {
788 return (AsciiCharInfo[value.Value] & 0x80) != 0;
789 }
790 if (value.IsBmp)
791 {
792 return CharUnicodeInfo.GetIsWhiteSpace((char)value._value);
793 }
794 return false;
795 }
796
798 {
799 if (culture == null)
800 {
802 }
804 {
805 return ToLowerInvariant(value);
806 }
807 return ChangeCaseCultureAware(value, culture.TextInfo, toUpper: false);
808 }
809
811 {
812 if (value.IsAscii)
813 {
815 }
817 {
819 }
820 return ChangeCaseCultureAware(value, TextInfo.Invariant, toUpper: false);
821 }
822
824 {
825 if (culture == null)
826 {
828 }
830 {
831 return ToUpperInvariant(value);
832 }
833 return ChangeCaseCultureAware(value, culture.TextInfo, toUpper: true);
834 }
835
837 {
838 if (value.IsAscii)
839 {
841 }
843 {
845 }
846 return ChangeCaseCultureAware(value, TextInfo.Invariant, toUpper: true);
847 }
848
850 {
851 if (obj == null)
852 {
853 return 1;
854 }
855 if (obj is Rune other)
856 {
857 return CompareTo(other);
858 }
860 }
861}
static UnicodeCategory GetUnicodeCategory(char ch)
static char ToLower(char codePoint)
static char ToUpper(char codePoint)
static CultureInfo InvariantCulture
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 readonly TextInfo Invariant
Definition TextInfo.cs:42
static string Arg_MustBeRune
Definition SR.cs:2178
Definition SR.cs:7
static bool IsSurrogateCodePoint(uint value)
static bool IsValidUnicodeScalar(uint value)
static void GetUtf16SurrogatesFromSupplementaryPlaneScalar(uint value, out char highSurrogateCodePoint, out char lowSurrogateCodePoint)
static bool IsInRangeInclusive(uint value, uint lowerBound, uint upperBound)
static int GetUtf8SequenceLength(uint value)
static uint GetScalarFromUtf16SurrogatePair(uint highSurrogateCodePoint, uint lowSurrogateCodePoint)
static int GetUtf16SequenceLength(uint value)
static bool IsAsciiCodePoint(uint value)
static bool IsBmpCodePoint(uint value)
static bool IsHighSurrogateCodePoint(uint value)
static int GetPlane(uint codePoint)
static bool IsLowSurrogateCodePoint(uint value)
static uint ConvertAllAsciiCharsInUInt32ToLowercase(uint value)
static uint ConvertAllAsciiCharsInUInt32ToUppercase(uint value)
static void ThrowArgumentException_CannotExtractScalar(ExceptionArgument argument)
static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
static void ThrowArgumentOutOfRange_IndexException()
static void ThrowArgumentNullException(string name)
static void ThrowArgumentException_DestinationTooShort()
int CompareTo(object? obj)
string ToString(string? format, IFormatProvider? formatProvider)
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format, IFormatProvider? provider)
Span< T > Slice(int start)
Definition Span.cs:271
static bool TryCreate(char highSurrogate, char lowSurrogate, out Rune result)
Definition Rune.cs:522
static bool operator>=(Rune left, Rune right)
Definition Rune.cs:120
static bool operator>(Rune left, Rune right)
Definition Rune.cs:115
override string ToString()
Definition Rune.cs:491
static bool operator<=(Rune left, Rune right)
Definition Rune.cs:110
static bool TryCreate(int value, out Rune result)
Definition Rune.cs:535
static bool IsLower(Rune value)
Definition Rune.cs:742
int CompareTo(Rune other)
Definition Rune.cs:163
static bool IsControl(Rune value)
Definition Rune.cs:710
static bool IsSeparator(Rune value)
Definition Rune.cs:765
int Utf16SequenceLength
Definition Rune.cs:55
static UnicodeCategory GetUnicodeCategoryNonAscii(Rune value)
Definition Rune.cs:671
Rune(uint scalarValue, bool unused)
Definition Rune.cs:90
static int ReadFirstRuneFromUtf16Buffer(ReadOnlySpan< char > input)
Definition Rune.cs:432
static bool IsLetter(Rune value)
Definition Rune.cs:724
static bool TryEncodeToUtf16(Rune value, Span< char > destination, out int charsWritten)
Definition Rune.cs:558
static bool IsCategoryNumber(UnicodeCategory category)
Definition Rune.cs:690
static Rune ToLowerInvariant(Rune value)
Definition Rune.cs:810
Rune(int value)
Definition Rune.cs:75
static Rune UnsafeCreate(uint scalarValue)
Definition Rune.cs:643
string DebuggerDisplay
Definition Rune.cs:33
static OperationStatus DecodeFromUtf16(ReadOnlySpan< char > source, out Rune result, out int charsConsumed)
Definition Rune.cs:168
Rune(char ch)
Definition Rune.cs:61
static bool IsValid(int value)
Definition Rune.cs:421
static bool IsLetterOrDigit(Rune value)
Definition Rune.cs:733
static bool operator!=(Rune left, Rune right)
Definition Rune.cs:100
static bool IsUpper(Rune value)
Definition Rune.cs:775
static bool IsSymbol(Rune value)
Definition Rune.cs:770
static bool IsCategoryLetterOrDecimalDigit(UnicodeCategory category)
Definition Rune.cs:681
bool IsAscii
Definition Rune.cs:47
static Rune ToLower(Rune value, CultureInfo culture)
Definition Rune.cs:797
static ReadOnlySpan< byte > AsciiCharInfo
Definition Rune.cs:15
readonly uint _value
Definition Rune.cs:13
static bool TryCreate(uint value, out Rune result)
Definition Rune.cs:541
static bool IsPunctuation(Rune value)
Definition Rune.cs:760
static bool operator<(Rune left, Rune right)
Definition Rune.cs:105
static OperationStatus DecodeFromUtf8(ReadOnlySpan< byte > source, out Rune result, out int bytesConsumed)
Definition Rune.cs:202
static bool TryEncodeToUtf8(Rune value, Span< byte > destination, out int bytesWritten)
Definition Rune.cs:585
static bool IsValid(uint value)
Definition Rune.cs:427
static bool IsCategorySymbol(UnicodeCategory category)
Definition Rune.cs:705
static bool IsWhiteSpace(Rune value)
Definition Rune.cs:784
static double GetNumericValue(Rune value)
Definition Rune.cs:648
static bool IsDigit(Rune value)
Definition Rune.cs:715
static Rune ReplacementChar
Definition Rune.cs:53
static OperationStatus DecodeLastFromUtf16(ReadOnlySpan< char > source, out Rune result, out int charsConsumed)
Definition Rune.cs:288
static Rune ToUpper(Rune value, CultureInfo culture)
Definition Rune.cs:823
static bool IsCategoryPunctuation(UnicodeCategory category)
Definition Rune.cs:695
static OperationStatus DecodeLastFromUtf8(ReadOnlySpan< byte > source, out Rune value, out int bytesConsumed)
Definition Rune.cs:321
static bool IsCategorySeparator(UnicodeCategory category)
Definition Rune.cs:700
static bool TryCreate(char ch, out Rune result)
Definition Rune.cs:511
Rune(char highSurrogate, char lowSurrogate)
Definition Rune.cs:70
override int GetHashCode()
Definition Rune.cs:406
bool TryEncodeToUtf8(Span< byte > destination, out int bytesWritten)
Definition Rune.cs:580
bool Equals(Rune other)
Definition Rune.cs:401
int EncodeToUtf8(Span< byte > destination)
Definition Rune.cs:383
static Rune ToUpperInvariant(Rune value)
Definition Rune.cs:836
static UnicodeCategory GetUnicodeCategory(Rune value)
Definition Rune.cs:662
int EncodeToUtf16(Span< char > destination)
Definition Rune.cs:374
static bool IsNumber(Rune value)
Definition Rune.cs:751
override bool Equals([NotNullWhen(true)] object? obj)
Definition Rune.cs:392
int Utf8SequenceLength
Definition Rune.cs:57
static Rune GetRuneAt(string input, int index)
Definition Rune.cs:411
static bool IsCategoryLetter(UnicodeCategory category)
Definition Rune.cs:676
static bool operator==(Rune left, Rune right)
Definition Rune.cs:95
static int ReadRuneFromString(string input, int index)
Definition Rune.cs:459
static bool TryGetRuneAt(string input, int index, out Rune value)
Definition Rune.cs:630
bool TryEncodeToUtf16(Span< char > destination, out int charsWritten)
Definition Rune.cs:553
static Rune ChangeCaseCultureAware(Rune rune, TextInfo textInfo, bool toUpper)
Definition Rune.cs:141
Rune(uint value)
Definition Rune.cs:81