I found this code on the internet:
private fun evaluateExpression(expression: String): Int {
val precedence = mapOf('+' to 1, '-' to 1, '*' to 2, '/' to 2)
fun applyOperator(operator: Char, operand2: Int, operand1: Int): Int {
return when (operator) {...