Add wxString::FromDouble() and FromCDouble().

wxString::FromCDouble() is needed inside wxWidgets itself to format numbers
independently of the current locale. FromDouble() was added for symmetry with
ToDouble/ToCDouble() functions.

Use std::locale for the implementation if available and manual wxLocale-based
fallback otherwise.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64449 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-31 11:55:48 +00:00
parent 105993f7b6
commit 951201d81c
4 changed files with 109 additions and 0 deletions

View File

@@ -2288,6 +2288,13 @@ public:
// convert to a double
bool ToCDouble(double *val) const;
// create a string representing the given floating point number
// in the current locale
static wxString FromDouble(double val)
{ return wxString::Format(wxS("%g"), val); }
// in C locale
static wxString FromCDouble(double val);
#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
// formatted input/output
// as sprintf(), returns the number of characters written or < 0 on error