Fixed unit multiplication
This commit is contained in:
parent
04cd1bb781
commit
a3a739b991
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue