Created
September 28, 2020 11:11
-
-
Save Emeka-Chukwu/e39212121405132ca4022e591dc340b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String addOperandToExpression(String operand, String mathsExpression) { | |
if (operands.contains(mathsExpression[mathsExpression.length - 1])) { | |
var toArray = mathsExpression.split(""); | |
toArray[toArray.length - 1] = operand; | |
mathsExpression = toArray.join(""); | |
} else { | |
operandsIndex.add(mathsExpression.length); | |
mathsExpression += operand; | |
} | |
dotTaken = false; | |
print(mathsExpression); | |
return mathsExpression; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment