Everything I tried gives an Error, it can handle the numbers but not the "+",what I want is the result to be "10". I'm attempting to make a calculator in android studio... This is what I tried:
var sum = "5+5" val num = sum.toInt() exercise.text = "$num" //the text displayed on the screen
toIntcall, which there isn't! If you want to parse a string as a set of numbers and operations, that's kinda complicated, but doable if you keep it simple (you'd be better finding a tutorial on it though if you're a beginner). If you want to actually make a typical calculator app, you'd be storing button presses instead, not holding the whole thing as a string and trying to work out what it means at the end