]> git.saurik.com Git - wxWidgets.git/commitdiff
Added code to remove sign from zero in wxPropertyGrid::DoubleToString(). Fixes #12738.
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 11 Dec 2010 11:57:26 +0000 (11:57 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 11 Dec 2010 11:57:26 +0000 (11:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/props.cpp

index f8d0857e7c2a7590a25cf83e40cbf03f4dacb715..27cb58494921d601ba453f063ef05b9e768c3001 100644 (file)
@@ -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,