mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-02-02 08:56:51 +01:00
fix a glitch introduced by thousands delimiter
This commit is contained in:
parent
49712ff64c
commit
a313e5de38
@ -31,7 +31,14 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
||||
|
||||
val valuesToCheck = numbersRegex.split(inputDisplayedFormula).filter { it.trim().isNotEmpty() }
|
||||
valuesToCheck.forEach {
|
||||
inputDisplayedFormula = inputDisplayedFormula.replace(it, Formatter.addGroupingSeparators(it))
|
||||
var newString = Formatter.addGroupingSeparators(it)
|
||||
|
||||
// allow writing numbers like 0.003
|
||||
if (it.contains(".")) {
|
||||
newString = newString.substringBefore(".") + ".${it.substringAfter(".")}"
|
||||
}
|
||||
|
||||
inputDisplayedFormula = inputDisplayedFormula.replace(it, newString)
|
||||
}
|
||||
|
||||
showNewResult(inputDisplayedFormula)
|
||||
|
Loading…
x
Reference in New Issue
Block a user