public static bool TryParseDouble(string str, out ScalarValue result)
{
result = null; // default the out value to null
str = trimPattern.Replace(str, "E"); // remove white space around "e"
double val;
if (double.TryParse(str, out val))
{
// use Create instead of new ScalarDoubleValue so doubles that
// represent integers will output a ScalarIntValue instead
result = Create(val);
return true;
}
return false;
}