Skip to content

Commit

Permalink
add auto multiply to e
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkempire78 committed Nov 20, 2022
1 parent 3804353 commit 4b239d6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/src/main/java/com/darkempire78/opencalculator/Expression.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,16 @@ class Expression {
cleanCalculation = cleanCalculation.addCharAtIndex('*', i+1)
cleanCalculationLength ++
}
if (i-1 >= 0 && (cleanCalculation[i-1] in "123456789)")) {
if (i-1 >= 0 && (cleanCalculation[i-1] in "πe123456789)")) {
cleanCalculation = cleanCalculation.addCharAtIndex('*', i)
cleanCalculationLength ++
}
} else if (cleanCalculation[i] == 'e') {
if (i+1 < cleanCalculation.length && (cleanCalculation[i+1] in "π123456789(")) {
cleanCalculation = cleanCalculation.addCharAtIndex('*', i+1)
cleanCalculationLength ++
}
if (i-1 >= 0 && (cleanCalculation[i-1] in "πe123456789)")) {
cleanCalculation = cleanCalculation.addCharAtIndex('*', i)
cleanCalculationLength ++
}
Expand Down

0 comments on commit 4b239d6

Please sign in to comment.