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

◆ ConvertToUtf32() [2/2]

static int System.Char.ConvertToUtf32 ( string s,
int index )
inlinestatic

Definition at line 801 of file Char.cs.

802 {
803 if (s == null)
804 {
805 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
806 }
807 if (index < 0 || index >= s.Length)
808 {
809 throw new ArgumentOutOfRangeException("index", SR.ArgumentOutOfRange_Index);
810 }
811 int num = s[index] - 55296;
812 if (num >= 0 && num <= 2047)
813 {
814 if (num <= 1023)
815 {
816 if (index < s.Length - 1)
817 {
818 int num2 = s[index + 1] - 56320;
819 if (num2 >= 0 && num2 <= 1023)
820 {
821 return num * 1024 + num2 + 65536;
822 }
823 throw new ArgumentException(SR.Format(SR.Argument_InvalidHighSurrogate, index), "s");
824 }
825 throw new ArgumentException(SR.Format(SR.Argument_InvalidHighSurrogate, index), "s");
826 }
827 throw new ArgumentException(SR.Format(SR.Argument_InvalidLowSurrogate, index), "s");
828 }
829 return s[index];
830 }

References System.SR.Argument_InvalidHighSurrogate, System.SR.Argument_InvalidLowSurrogate, System.SR.ArgumentOutOfRange_Index, System.SR.Format(), System.index, System.s, and System.ThrowHelper.ThrowArgumentNullException().