From a3a739b991d2e5f0beb59f9b5a34b4b102378f38 Mon Sep 17 00:00:00 2001 From: George Litvinov Date: Wed, 23 Oct 2019 15:27:42 +0300 Subject: [PATCH] Fixed unit multiplication --- src/main/java/writer2latex/util/Calc.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/writer2latex/util/Calc.java b/src/main/java/writer2latex/util/Calc.java index 4b173f1..ffa3c24 100644 --- a/src/main/java/writer2latex/util/Calc.java +++ b/src/main/java/writer2latex/util/Calc.java @@ -168,8 +168,8 @@ public class Calc { public static final String multiply(String sPercent, String sLength){ if (sLength.equals("0")) { return "0"; } float fPercent=getFloat(sPercent.substring(0,sPercent.length()-1),1); - float fLength=getFloat(sLength.substring(0,sLength.length()-2),1); - String sUnit=sLength.substring(sLength.length()-2); + float fLength=getFloat(sLength.replaceAll("[^0-9,.,-]", ""),1); + String sUnit=sLength.replaceAll("[0-9,.,-]", ""); return Float.toString(fPercent*fLength/100)+sUnit; }