From: Jaakko Salli Date: Sat, 11 Dec 2010 11:57:26 +0000 (+0000) Subject: Added code to remove sign from zero in wxPropertyGrid::DoubleToString(). Fixes #12738. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0b4e4c3937371a1404c0847b3e355a2dd6063d6b?ds=inline Added code to remove sign from zero in wxPropertyGrid::DoubleToString(). Fixes #12738. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index f8d0857e7c..27cb584949 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -713,6 +713,25 @@ void wxPropertyGrid::DoubleToString(wxString& target, if ( new_len != target.length() ) target.resize(new_len); } + + // Remove sign from zero + if ( target.length() >= 2 && target[0] == wxS('-') ) + { + bool isZero = true; + wxString::const_iterator i = target.begin() + 1; + + for ( ; i != target.end(); i++ ) + { + if ( *i != wxS('0') && *i != wxS('.') ) + { + isZero = false; + break; + } + } + + if ( isZero ) + target.erase(target.begin()); + } } wxString wxFloatProperty::ValueToString( wxVariant& value,