Index: runtime/vm/double_conversion.cc |
diff --git a/runtime/vm/double_conversion.cc b/runtime/vm/double_conversion.cc |
index 7f5b07211680febedfc3dd1f91341c9bd8443345..44233febbd128005bce94138c08a9804e04e1aeb 100644 |
--- a/runtime/vm/double_conversion.cc |
+++ b/runtime/vm/double_conversion.cc |
@@ -166,4 +166,25 @@ RawString* DoubleToStringAsPrecision(double d, int precision) { |
return String::New(builder.Finalize()); |
} |
+ |
+bool CStringToDouble(const char* str, intptr_t length, double* result) { |
+ if (length == 0) { |
+ return false; |
+ } |
+ |
+ double_conversion::StringToDoubleConverter converter( |
+ double_conversion::StringToDoubleConverter::NO_FLAGS, |
+ 0.0, |
+ 0.0, |
+ kDoubleToStringCommonInfinitySymbol, |
+ kDoubleToStringCommonNaNSymbol); |
+ |
+ int parsed_count = 0; |
+ *result = converter.StringToDouble(str, |
+ static_cast<int>(length), |
+ &parsed_count); |
+ return (parsed_count == length); |
+} |
+ |
+ |
} // namespace dart |