[gnome-calculator] Ignore thousands separators in CLI tools



commit 3dd9f729fe96feda1ffa8cc60f2c742486c18799
Author: PioneerAxon <arth svnit gmail com>
Date:   Thu Dec 6 03:09:41 2012 +0530

    Ignore thousands separators in CLI tools

 src/gcalccmd.vala         |    6 +++++-
 src/gnome-calculator.vala |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/gcalccmd.vala b/src/gcalccmd.vala
index bc5e7a0..35f37dc 100644
--- a/src/gcalccmd.vala
+++ b/src/gcalccmd.vala
@@ -15,7 +15,11 @@ private static Serializer result_serializer;
 
 static void solve (string equation)
 {
-    var e = new Equation (equation);
+    var tsep_string = nl_langinfo (NLItem.THOUSEP);
+    if (tsep_string == null || tsep_string == "")
+        tsep_string = " ";
+
+    var e = new Equation (equation.replace (tsep_string, ""));
     e.base = 10;
     e.wordlen = 32;
     e.angle_units = AngleUnit.DEGREES;
diff --git a/src/gnome-calculator.vala b/src/gnome-calculator.vala
index dfdbc43..7401ed4 100644
--- a/src/gnome-calculator.vala
+++ b/src/gnome-calculator.vala
@@ -347,7 +347,11 @@ public class Calculator : Gtk.Application
 
         if (solve_equation != null)
         {
-            var e = new SolveEquation (solve_equation);
+            var tsep_string = nl_langinfo (NLItem.THOUSEP);
+            if (tsep_string == null || tsep_string == "")
+                tsep_string = " ";
+
+            var e = new SolveEquation (solve_equation.replace (tsep_string, ""));
             e.base = 10;
             e.wordlen = 32;
             e.angle_units = AngleUnit.DEGREES;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]