Skip to content

Commit

Permalink
fixed bug that removes 0. in expression at the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
luhluh-17 committed Jun 22, 2020
1 parent dc157c7 commit 6567699
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/providers/calculate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class Calculate with ChangeNotifier {
}

// dot and any operator excluding -
RegExp regExp1 = RegExp(r'[÷×+]$');
RegExp regExp1 = RegExp(r'[.÷×+]$');
if (expression == '0' && regExp1.hasMatch(buttonValue)) {
// _expression += buttonValue will not work
// _getExpression() returns exp if string not empty
Expand Down Expand Up @@ -185,7 +185,7 @@ class Calculate with ChangeNotifier {
}

// removes 0 at start
RegExp regExp4 = RegExp(r'\d');
RegExp regExp4 = RegExp(r'0\d');
if (expression.startsWith('0') && regExp4.hasMatch(expression)) {
_expression = buttonValue;
} else {
Expand Down

0 comments on commit 6567699

Please sign in to comment.