| 197 | } // namespace internal |
| 198 | |
| 199 | double StringToDouble(const std::string& str) { |
| 200 | std::istringstream iss(str); |
| 201 | iss.imbue(std::locale::classic()); |
| 202 | double value; |
| 203 | iss >> value; |
| 204 | THROW_CHECK(!iss.fail()) << "Failed to parse floating-point value: " << str; |
| 205 | // Verify no trailing non-whitespace characters remain. |
| 206 | std::string remaining; |
| 207 | iss >> remaining; |
| 208 | THROW_CHECK(remaining.empty()) |
| 209 | << "Failed to parse floating-point value: " << str; |
| 210 | return value; |
| 211 | } |
| 212 | |
| 213 | std::string StringPrintf(const char* format, ...) { |
| 214 | va_list ap; |