I have an expression when in my code, which does:
when{
currentOpperand.text.toString().endsWith("+") ||
currentOpperand.text.toString().endsWith("-") ||
currentOpperand.text.toString().endsWith("÷") ||
currentOpperand.text.toString().endsWith("×") ||
currentOpperand.text.toString().endsWith(".") ||
currentOpperand.text.toString().endsWith("")
->{
currentOpperand.text = currentOpperand.text.toString() + ""
}
I want to make this code shorter, like:
when{
currentOpperand.text.toString().endsWith("+", "-", "÷", "×", ".", "") ->{
currentOpperand.text = currentOpperand.text.toString() + ""
}
But android studio gives me an error:
None of the following functions can be called with the argument supplied
If it's possible, comment please another way to do these using things like: lastIndexOfAny or etc. (I want to do this action in any way possible with the shortest result in code)