| Index: base/string_util.h
|
| ===================================================================
|
| --- base/string_util.h (revision 5165)
|
| +++ base/string_util.h (working copy)
|
| @@ -127,6 +127,14 @@
|
| // Names of codepages (charsets) understood by icu.
|
| extern const char* const kCodepageUTF8;
|
|
|
| +// When some function takes an optional parameter to control locale
|
| +// independence, you should use values from here to make function call
|
| +// look more descriptive.
|
| +enum LocaleDependence {
|
| + LOCALE_DEPENDENT = true,
|
| + LOCALE_INDEPENDENT = false
|
| +};
|
| +
|
| // Removes characters in trim_chars from the beginning and end of input.
|
| // NOTE: Safe to use the same variable for both input and output.
|
| bool TrimString(const std::wstring& input,
|
| @@ -354,6 +362,9 @@
|
| std::string Uint64ToString(uint64 value);
|
| std::wstring Uint64ToWString(uint64 value);
|
|
|
| +std::string DoubleToString(double value, LocaleDependence locale_dependent);
|
| +std::wstring DoubleToWString(double value, LocaleDependence locale_dependent);
|
| +
|
| // 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,8 +387,14 @@
|
| // 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::string& input, double* output,
|
| + LocaleDependence locale_dependent);
|
| bool StringToDouble(const std::wstring& input, double* output);
|
| +bool StringToDouble(const std::wstring& input, double* output,
|
| + LocaleDependence locale_dependent);
|
|
|
| // Convenience forms of the above, when the caller is uninterested in the
|
| // boolean return value. These return only the |*output| value from the
|
| @@ -388,8 +405,13 @@
|
| 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::string& value,
|
| + LocaleDependence locale_dependent);
|
| double StringToDouble(const std::wstring& value);
|
| +double StringToDouble(const std::wstring& value,
|
| + LocaleDependence locale_dependent);
|
|
|
| // Return a C++ string given printf-like input.
|
| std::string StringPrintf(const char* format, ...);
|
|
|