Index: base/string_util.h |
diff --git a/base/string_util.h b/base/string_util.h |
index d62e9b0a9b4b0bc2376cb63749b8f2ba184ce6c0..0a79c6f50cbe07ef3f77864d8a1db620c413a329 100644 |
--- a/base/string_util.h |
+++ b/base/string_util.h |
@@ -95,6 +95,23 @@ size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size); |
// This function is intended to be called from base::vswprintf. |
bool IsWprintfFormatPortable(const wchar_t* format); |
+enum LocaleDependence { |
+ LOCALE_DEPENDENT, |
+ LOCALE_INDEPENDENT |
+}; |
+ |
+std::string DoubleToString(double value, LocaleDependence locale_dependent); |
+std::wstring DoubleToWString(double value, LocaleDependence locale_dependent); |
+ |
+bool StringToDouble(const std::string& input, double* output, |
+ LocaleDependence locale_dependent); |
+bool StringToDouble(const std::wstring& input, double* output, |
+ LocaleDependence locale_dependent); |
+double StringToDouble(const std::string& value, |
+ LocaleDependence locale_dependent); |
+double StringToDouble(const std::wstring& value, |
+ LocaleDependence locale_dependent); |
+ |
} // namespace base |
#if defined(OS_WIN) |
@@ -354,6 +371,7 @@ std::wstring Int64ToWString(int64 value); |
std::string Uint64ToString(uint64 value); |
std::wstring Uint64ToWString(uint64 value); |
+ |
// Perform a best-effort conversion of the input string to a numeric type, |
// setting |*output| to the result of the conversion. Returns true for |
// "perfect" conversions; returns false in the following cases: |
@@ -376,6 +394,8 @@ bool HexStringToInt(const std::wstring& input, int* output); |
// numbers in hexadecimal, and strings representing non-fininte values (such |
// as NaN and inf) is undefined. Otherwise, these behave the same as the |
// integral variants above. |
+// |
+// By default, locale-dependent variant is used. |
bool StringToDouble(const std::string& input, double* output); |
bool StringToDouble(const std::wstring& input, double* output); |
@@ -388,6 +408,7 @@ int64 StringToInt64(const std::string& value); |
int64 StringToInt64(const std::wstring& value); |
int HexStringToInt(const std::string& value); |
int HexStringToInt(const std::wstring& value); |
+// By default, locale-dependent variant is used. |
double StringToDouble(const std::string& value); |
double StringToDouble(const std::wstring& value); |