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

◆ TryToDouble()

static Exception System.Xml.XmlConvert.TryToDouble ( string s,
out double result )
inlinestaticpackage

Definition at line 919 of file XmlConvert.cs.

920 {
921 s = TrimString(s);
922 if (s == "-INF")
923 {
924 result = double.NegativeInfinity;
925 return null;
926 }
927 if (s == "INF")
928 {
929 result = double.PositiveInfinity;
930 return null;
931 }
932 if (!double.TryParse(s, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, NumberFormatInfo.InvariantInfo, out result))
933 {
934 return new FormatException(System.SR.Format(System.SR.XmlConvert_BadFormat, s, "Double"));
935 }
936 if (result == 0.0 && s[0] == '-')
937 {
938 result = -0.0;
939 }
940 return null;
941 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlConvert_BadFormat
Definition SR.cs:370
Definition SR.cs:7
static string TrimString(string value)

References System.Xml.Dictionary, System.SR.Format(), System.Globalization.NumberFormatInfo.InvariantInfo, System.s, System.Xml.XmlConvert.TrimString(), and System.SR.XmlConvert_BadFormat.

Referenced by System.Xml.Xsl.Runtime.XsltFunctions.MSNumber(), and System.Xml.Schema.Datatype_double.TryParseValue().