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

@@ -1507,6 +1507,36 @@ public:
static wxString FromAscii(char c);
//@}
/**
Returns a string with the textual representation of the number in C
locale.
Unlike FromDouble() the string returned by this function always uses
the period character as decimal separator, independently of the current
locale.
@since 2.9.1
@see ToCDouble()
*/
static wxString FromCDouble(double val);
/**
Returns a string with the textual representation of the number.
This is a simple wrapper for @code wxString::Format("%g", val)
@endcode.
Notice that the string returned by this function uses the decimal
separator appropriate for the current locale, e.g. @c "," and not a
period in French locale. Use FromCDouble() if this is unwanted.
@since 2.9.1
@see ToDouble()
*/
static wxString FromDouble(double val);
//@{
/**
Converts C string encoded in UTF-8 to wxString.