1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* A utility function that converts a string to a double independent of OS locale. */
8 #ifndef MOZILLA_DOUBLECONVERSION_H
9 #define MOZILLA_DOUBLECONVERSION_H
11 #include "mozilla/Maybe.h"
12 #include "mozilla/Span.h"
18 // Parses aStringSpan into a double floating point value. Always treats . as the
19 // decimal separator, regardless of OS locale. Consumes the entire string;
20 // trailing garbage is invalid. Returns Nothing() for invalid input.
21 // The implementation uses double_conversion::StringToDoubleConverter with
22 // NO_FLAGS, see double-conversion/string-to-double.h for more documentation.
23 Maybe
<double> StringToDouble(Span
<const char> aStringSpan
);
27 #endif // MOZILLA_DOUBLECONVERSION_H