Chromium Code Reviews| Index: components/ui_devtools/string_util.h |
| diff --git a/components/ui_devtools/string_util.h b/components/ui_devtools/string_util.h |
| index 4efb835380f6a18569a0e54b06ca8fae1f7f9232..14ff27e7f7727213837464add978f9219304d0a6 100644 |
| --- a/components/ui_devtools/string_util.h |
| +++ b/components/ui_devtools/string_util.h |
| @@ -45,6 +45,13 @@ class StringUtil { |
| static String fromDouble(double number) { |
| return base::DoubleToString(number); |
| } |
| + static double toDouble(const char* s, size_t len, bool* ok) { |
| + double v = 0.0; |
| + *ok = base::StringToDouble(std::string(s, len), &v); |
| + if (!*ok) |
| + v = 0.0; |
|
dgozman
2017/04/27 23:06:31
nit: return *ok ? v : 0.0;
kozy
2017/04/28 00:16:45
Done.
|
| + return v; |
| + } |
| static void builderAppend(StringBuilder& builder, const String& s) { |
| builder.append(s); |
| } |